Code examples that show how to use Boto3 to access Amazon Web Services (AWS).
- You must have an AWS account, and have your default credentials and AWS Region configured as described in the AWS Tools and SDKs Shared Configuration and Credentials Reference Guide.
- Python 3.6 or later
- Boto3 1.11.10 or later
- PyTest 5.3.5 or later (to run unit tests)
For Boto3 and AWS documentation, see the following:
Shows how to use the AWS SDK for Python (Boto3) to create an Amazon DynamoDB table for storing movies, load movies into the table from a JSON-formatted file, and update and query movies in various ways.
Shows how to use the AWS SDK for Python (Boto3) and the Amazon DAX Client for
Python to read items from an Amazon DynamoDB table. Retrieval, query, and scan speeds
are measured for both Boto3 and DAX clients to show some of the performance
advantages of using DAX.
DAX is a DynamoDB-compatible caching service that provides fast in-memory performance and high availability for applications that demand microsecond latency. For more information, see In-Memory Acceleration with DynamoDB Accelerator (DAX).
Shows how to use the AWS SDK for Python (Boto3) to manage Amazon Compute Cloud (Amazon EC2) resources. Learn to accomplish the following tasks:
- Create security keys, groups, and instances.
- Start and stop instances, use Elastic IP addresses, and update security groups.
- Clean up security keys and security groups.
- Permanently terminate instances.
Shows how to use the AWS SDK for Python (Boto3) to manage AWS Identity and Access Management (IAM) resources. Learn to accomplish the following tasks:
- Create and manage IAM user access keys.
- Manage the alias of an account.
- Acquire reports about account usage.
- Create and manage IAM policies, including versioned policies.
- Create and manage IAM roles, including how to attach and detach policies.
- Create and manage IAM users, including how to attach a policy to a user.
Shows how to use the AWS SDK for Python (Boto3) transfer manager to manage multipart uploads to and downloads from an Amazon Simple Storage Service (Amazon S3) bucket.
When the file to transfer is larger than the specified threshold, the transfer manager automatically uses multipart uploads or downloads. This example shows how to use several of the available transfer manager settings, and reports thread usage and time to transfer.
Shows how to use the AWS SDK for Python (Boto3) to get started using bucket and object operations in Amazon Simple Storage Service (Amazon S3). Learn to create, get, remove, and configure buckets and objects.
Shows how to use the AWS SDK for Python (Boto3) to set up an Amazon S3 bucket for versioning, and how to perform taks on a version-enabled bucket. Learn to accomplish the following tasks:
- Create a version-enabled bucket and apply revisions to its objects.
- Get a full series of object versions.
- Roll back to a previous version.
- Revive a deleted object.
- Permanently delete all versions of an object.
Shows how to manipulate Amazon S3 versioned objects in batches by creating jobs that call AWS Lambda functions to perform processing. Learn to accomplish the following tasks:
- Create Lambda functions that operate on versioned objects.
- Create a manifest of objects to update.
- Create batch jobs that invoke Lambda functions to update objects.
- Delete Lambda functions.
- Empty and delete a versioned bucket.
Shows how to use the AWS SDK for Python (Boto3) to get started using queue and message operations in Amazon Simple Queue Service (Amazon SQS). Learn how to create, get, and remove standard, FIFO, and dead-letter queues. Learn how to send, receive, and delete messages from a queue.
Shows how to use the AWS Python SDK (Boto3) to access the AWS Security Token Service (AWS STS) to acquire temporary credentials that grant specific permissions. Also demonstrates how to set up and use a multi-factor authentication (MFA) device. Learn to accomplish the following tasks:
- Assume a role that grants specific permissions, and use those credentials to perform permitted actions.
- Add a new MFA device to a user.
- Assume a role that requires MFA to be present.
- Construct a URL that gives federated users direct access to an account through the AWS Management Console.
- Get a session token that can be used to call an API function that requires MFA.
Centralizes PyTest fixtures and specialized stubbers based on the botocore Stubber that Python code examples can use for unit tests.
- As an AWS best practice, grant this code least privilege, or only the permissions required to perform a task. For more information, see Grant Least Privilege in the AWS Identity and Access Management User Guide.
- This code has not been tested in all AWS Regions. Some AWS services are available only in specific Regions. For more information, see the AWS Regional Table
- Running this code might result in charges to your AWS account.
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0