This article is for people who want to experience AWS Lambda for the time being. There are many articles for beginners such as "In cooperation with S3", There were few people who posted a surprisingly simple implementation, so I tried it this time. You can experience AWS Lambda in about 10 minutes at the earliest.
① Create AWS Lambda function ↓ ② Create API Gateway, connect with AWS Lambda ↓ ③ Test
Create from scratch to create a function named test_func. The runtime can be anything, but this time I'll choose pyhon.
When created, it looks like this ↓. The trigger (input to AWS Lambda) is set when the API Gateway is created, so we will not operate it yet.
Build a "REST API" API Gateway. It's hard to understand, but it's not an import.
Set an appropriate "API name". (This time I chose test_api.)
Add a resource (like a vessel to put a method in). Select Create Resource from the Actions tab. Enter the resource name as you like and click "Create Resource".
Add a method. Select Create Method from the Actions tab to add a GET method. Enter the name of the Lambda function you created earlier in "Lambda function". Since the input prediction comes out, you can choose by entering only the first letter.
When you press "Save", you will be asked if you want to grant permission, so select "OK".
Finally, deploy (reflect the build) the API Gateway you have created so far. At this time, you will be asked to enter the stage (the version at the time of deployment), so enter it appropriately. That's all there is to it.
Make a request to the API Gatewary created earlier with the GET method. Click "GET" on the stage you just deployed to see the URL. Click here.
If "Hello from Lambda!" Is displayed as shown in the image below, it is successful.
Thank you for your support.
Most aimed at experiencing AWS Lambda? I implemented a simple AWS Lambda. In the future, I would like to create a more complicated system based on this.
・ AWS Lambda https://aws.amazon.com/jp/lambda/ AWS official website
· AWS API Gateway to Lambda Tutorial in Python | Build a REST API https://www.youtube.com/watch?v=uFsaiEhr1zs Most of the steps are taken. The English commentary is easier to understand than the Japanese commentary.
Recommended Posts