From the course: Cloud Native Projects: AWS Serverless

Challenge: Python

(upbeat music) - [Instructor] Now it's time for our first challenge exercise for this course. We're going to be using the Python language for this challenge and you're going to create a function that actually does some work and use it as a Lambda function that you deploy. Now, part of the steps that I'm going to ask you to implement as part of this challenge are as follow. So I want you this time to start with the local Python file instead of the code editor from AWS Console. Now, there's nothing wrong with the code editor, it's just a little bit more realistic to store your code in source control and to do that locally as opposed to doing it in their code editor. Now, in order to actually upload your zip file that you're going to create, you need to follow the instructions linked here that will tell you how to create a role in your AWS account. Now, I'm assuming that you have AWS set up with credentials. If you do not, please stop and go do that first. But what you're going to do is you're going to create a zip file after you create a role, and then you're going to upload that zip file using the CLI. You're going to create a coin-flip program. The coin-flip program is going to input a number from the JSON payload for the number of flips to execute. You will then randomize those results and generate either a heads or a tails based on that randomization. And then at the end, in the actual response for the Python, I want you to spit out the number of flips and the results of those flips themselves. So in addition to doing any logging that you want to do, I actually want you to turn this into a response that you sent outbound. So you're on your own. On the next video, I'm going to show you my solution to this problem.

Contents