Amazon Web Services (AWS) Lambda provides a usage-based compute service for running Python code in response to developer-defined events. For example, if an inbound HTTP POST comes in to API Gateway or a new file is uploaded to AWS S3 then AWS Lambda can execute a function to respond to that API call or manipulate the file on S3.
AWS Lambdas are not related to the Python languages' lambda expressions,
which are used to create anonymous functions. The AWS Lambda name just
happens to collide with the the lambda keyword's name.
Let's learn how to quickly write and run a Lambda function to execute basic Python 3.6 code which uses environment variables as input. This code, which is also available on GitHub under the blog-post-examples repository can be changed so that you can build much more complicated Python programs.
No local development environment tools are required for this tutorial, other than a web browser. All the work will happen on AWS via their Console.
These steps can also be completed from the command line via the boto3 library, but we won't cover that in this post.
If using Python 2 is still your jam rather than Python 3, take a look at this other post which shows how to execute Python 2.7 code on AWS Lambda.
Sign up for a new Amazon Web Services account, which provides a generous free tier, or use your existing AWS account.

After signing up a few tutorials may pop up, but skip past them and go to the main Console. AWS has tons of services, with more being added every month, so using the search box is the best way to get around. Select the search text box, enter "lambda" and select "Lambda" to get to the Lambda starting page.

Click the "Create a Lambda function" button. The "Select Blueprint" page will appear.

Select "Blank Function" and the "Configure triggers" page will come up. It was non-obvious to me at first, but you don't actually need to configure a trigger to move on. A trigger is how the Lambda function typically knows when to execute based on an event from another AWS service such as API Gateway or Cloudwatch.

We won't configure a trigger for this function because we can manually kick off the Lambda to test it when we are finished configuring it. Leave the trigger icon blank and click the "Next" button to move along.

Next we get to the "Configure function" screen where we can finally write some code!
Enter a name for the Lambda function, such as "python_3_6_lambda_test", as well as a description. A description is optional but it is useful when you have a dozens or hundreds of different Lambda functions and need to keep them straight. In the Runtime drop-down, select Python 3.6 for the programming language.