Python examples on AWS (Amazon Web Services)
This repo contains Python code examples on AWS (Amazon Web Services).
These examples show how to use Python 3 and Boto 3 in order to manage Amazon services on AWS. These use Resource API (high-level) and Client API (low-level) of Boto 3.
Boto 3 is the AWS (Amazon Web Services) SDK for Python, which allows Python developers to write software that makes use of Amazon services like EC2 and S3. Boto provides an easy to use, object-oriented API as well as low-level direct service access.
Boto 3 offers two different styles of API:
- Resource API (high-level): It provides an object-oriented abstraction on top (object.delete(), object.put(), etc.).
- Client API (low-level): It maps directly to the underlying RPC-style service operations (put_object, delete_object, etc.).
Quick start
You must have an AWS (Amazon Web Services) account.
The code for the samples is contained in individual folders on this repository.
For instructions on running the code, please consult the README in each folder.
This is the list of examples:
Compute - Amazon EC2:
Compute - AWS Lambda:
-
Lambda function handler:
-
awslambdahello - AWS Lambda Function Hello World: Example of how to handle an AWS simple Lambda function and a text input.
-
awslambdahellojson - AWS Lambda Function Hello World JSON: Example of how to handle an AWS simple Lambda function and a JSON input.
-
awslambdahttprequest - AWS Lambda Function Http Request: Example of how to handle an AWS Lambda Function, show the parameters of the request and repond a message including the parameters.
-
awslambdas3event - AWS Lambda Function S3 Event: Example of how to handle an AWS Lambda Function and send information to the log about an object when it appears in a S3 bucket.
-
Lambda function handler using the Client API (low-level) of Boto 3:
-
awslambdas3copy-capi - AWS Lambda Function S3 Copy: Example of how to handle an AWS Lambda function and copy an object when it appears in a S3 bucket to another S3 bucket. It uses the Client API (low-level) of Boto 3.
-
awslambdas3move-capi - AWS Lambda Function S3 Move: Example of how to handle an AWS Lambda function and move an object when it appears in a S3 bucket to another S3 bucket. It uses the Client API (low-level) of Boto 3.
-
Lambda function handler using the Resource API (high-level) of Boto 3:
-
awslambdas3copy-rapi - AWS Lambda Function S3 Copy: Example of how to handle an AWS Lambda function and copy an object when it appears in a S3 bucket to another S3 bucket. It uses the Resource API (high-level) of Boto 3.
-
awslambdas3move-rapi - AWS Lambda Function S3 Move: Example of how to handle an AWS Lambda function and move an object when it appears in a S3 bucket to another S3 bucket. It uses the Resource API (high-level) of Boto 3.
-
Lambda service client - Service operations - Using the Client API (low-level) of Boto 3:
-
awslambdacreate-capi - AWS Lambda Function Create: Example of how to handle an AWS Lambda function and create it. It uses the Client API (low-level) of Boto 3.
-
awslambdaupdate-capi - AWS Lambda Function Update: Example of how to handle an AWS Lambda function and update it. It uses the Client API (low-level) of Boto 3.
-
awslambdainvoke-capi - AWS Lambda Function Invoke: Example of how to handle an AWS Lambda function and invoke it. It uses the Client API (low-level) of Boto 3.
-
awslambdalist-capi - AWS Lambda Function List: Example of how to handle an AWS Lambda function and list its information. It uses the Client API (low-level) of Boto 3.
-
awslambdalistall-capi - AWS Lambda Function List All: Example of how to handle AWS Lambda functions and list all Lambda functions and their information. It uses the Client API (low-level) of Boto 3.
-
awslambdadelete-capi - AWS Lambda Function Delete: Example of how to handle an AWS Lambda function and delete it. It uses the Client API (low-level) of Boto 3.
Storage - Amazon S3:
License
This code is released under the MIT License. See LICENSE file.