Skip to content
Welcome to the AWS Code Example Repository. This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.rst file below.
Java Python PHP C# C++ Go Other
Branch: master
Clone or download
scmacdon Merge pull request #941 from scmacdon/master
Updated Java 1 code examples that have passed a Java Linter test
Latest commit 1c48f50 Jan 22, 2020
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Delete labeler.yml Jan 20, 2020
c/example_code editing printed out warnings Jan 4, 2019
cloudformation Added blank lines to YAML file for readability May 20, 2019
cpp Merge branch 'master' into transfer Jan 7, 2020
dotnet Added a 'using' statement. (#934) Jan 20, 2020
go Fixed snippet tags (were referring to CloudWatch) Jan 21, 2020
iam_policies Minor update to remove template artifact. May 22, 2019
java Update Jan 22, 2020
javascript correct string on console.log Nov 12, 2019
javav2 Update Jan 22, 2020
lambda_functions adding syntax highlighting to Ruby examples Sep 9, 2019
php/example_code Revised checking in if statement Oct 25, 2019
python Small edits Jan 21, 2020
ruby/example_code adding syntax highlighting to Ruby examples Sep 9, 2019
typescript/example_code Merge branch 'master' into nodejs-version Jan 14, 2020
.gitignore Added __pycache__ to .gitignore. This folder is created when Python c… Dec 18, 2019
.travis.yml setting the metadata check to run as quiet Jan 14, 2019 Adding standard files Aug 2, 2018 Update Aug 2, 2019
LICENSE Adding top level licensing files Aug 2, 2018
NOTICE Adding top level licensing files Aug 2, 2018
README.rst Removed reference to code catalog (#933) Jan 16, 2020 Adding a Metadata Scan for 40 or 20 character strings that might be S… May 23, 2019 Create Sep 6, 2019



This is the repository for code samples used in the public AWS documentation. The examples use the AWS Software Developer Kits (SDKs) for the supported programming languages. For more information, see Tools to Build on AWS.

Finding code examples

The code examples are organized by programming language. For instance, all of the examples for the AWS SDK for Java Developer Guide are kept in the java directory.

You can also try using the preview of our use case index of examples (and let us know what you think about it).

Building and running code examples

Inside each of the language-specific directories, you'll find a README file that explains how to build and run the examples contained within it.

The example code inside the language-specific directories is organized by the AWS service abbreviation ("s3" for Amazon S3 examples, and so on).

Proposing new code examples

To propose a new code example for the AWS documentation team to consider working on, create a new request.

The AWS documentation team is looking to produce code examples that cover broader scenarios and use cases, versus simple code snippets that cover only individual API calls.

From time to time, the AWS documentation team will select some of these proposals to begin working on. To view their decisions, see the code examples roadmap. If you feel strongly about seeing the timeline of a particular proposal accelerated or the scope of a particular proposal expanded or focused, be sure to +1 the related issue, add comments to it, or both, and the team will take this under consideration.

The AWS documentation team typically moves accepted proposals in the roadmp from the Wish List stage to the Backlog stage, then to the In Progress stage, and finally to the Recently Completed stage. The Wish List stage represents proposals that the team might begin working on at some point in the future but with no expected timeline, while the Backlog stage represents proposals that the team will likely begin working on soon. To view the team's progress, see the code examples roadmap.

Submitting code examples for use in AWS documentation

If you plan to contribute examples for use in the documentation (the purpose of this repository), please read this section carefully so that we can work together more effectively. For process instructions and additional guidance, see the Guidelines for contributing.

  • Make sure that the code can be built and run. There's nothing more frustrating in developer documentation than code examples that don't work. Build the code and test it before submitting it!

  • Do not include personal account data, keys or IDs in your examples. Code should obtain access keys from the standard SDK credentials and config files, use environment variables or external data files, or query the user for this information.

  • Format code lines to 80 characters. Long lines can be enclosed in a scrollable box for HTML, but in a PDF build, long lines will often spill off the side of the page, making the code unreadable. If your code includes long text strings, consider breaking these into smaller chunks and concatenating them together.

  • Use short(er) variable names. To aid in readability and to help keep line length down, use short yet descriptive names for variables. Do not simply mimic class names when creating variables that represent an object of that class. It nearly always results in excessively long variable names, making it difficult to keep code lines within 80 characters.

  • Use spaces, not tabs, for indentation. Tabs are variable-length in most editors, but will usually render as 8 characters wide in printed documentation. Always use spaces to ensure consistent formatting in printed code.

    You can ignore this rule for makefiles, which may require the use of tabs, but these are typically only used for building examples, and are not included in documentation.

  • Minimize the use of comments. Code is ignored for translation, so comments in code are not translated for the printed documentation's target language. Comments should not be needed in most code used for documentation, since the goal is clarity and ease of understanding. By making code self-explanatory, you'll make better code for documentation and reduce the need to add comments.

  • Place comments on separate lines from code. If you must add a comment for explanation or any other purpose, make sure that it's placed on a separate line from code (not inline). This allows readers of the source file to read the comment, yet it can be stripped out when including snippets from the file within documentation.

  • All code must be submitted under the Apache 2.0 license, as noted in the following Copyright and License section.

Copyright and License

All content in this repository, unless otherwise stated, is Copyright © 2010-2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Except where otherwise noted, all examples in this collection are licensed under the Apache license, version 2.0 (the "License"). The full license text is provided in the LICENSE file accompanying this repository.

You can’t perform that action at this time.