By Nobukimi Sasaki (2023-04-24)
Create Dynamo DB
In AWS management console, pick Dynamo DB. In this example, the table name is “employee”. Give the primary key name “empId” in String.
Create Lambda Function:
In AWS management console, pick Lambda, then “Create function”. In this example, “RestApiLambda”.
The Runtime, “Java 11”, the table name is “employee”. Give the primary key name “empId” in String.
Providing a role:
Go to “IMA” console, choose “Lambda”, set the permission to “AmazonDynamoDBFullAccess”, “AWSLambdaBasicExecutionRole”.
Give the role name. In this example, “crudAPIRole”. After creating the role, check “use existing role”, and “Create function”.
Create API Gateway:
In AWS management console, pick “API Gateway”. Choose protocol “REST” and “New API”. In this example, API name is “EmployeeAPI”.
Specify the “Resources” for the API:
Under “API:EmployeeAPI”, click “Resource” then set the name “employee” it make the path …/employee as URL.
Check Enable API Gateway CORS.
1. Click the name of the resource (“employee” in this example)
2. Create Method
3. Select “POST” depends in the type.
4. Check this
5. Lambda Function
6. Use Lambda Proxy Integration
7. Type the name of function you have created (“RestApiLambda” in this example)
8. Save
1. Action
2. Deploy API
3. New Stage
4. dev (environment)
5. Deploy
After deployed, this is the URL for the API.