Objective: Create a RESTful API using AWS API Gateway to integrate with Lambda functions (
getStudentData
,insertStudentData
,BackupDynamoDBAndSendEmail
), allowing the web interface (running on CloudFront) to access, store, and back up student data. The API will be secured with an API Key, use a Usage Plan to limit access, and enable CORS to support communication with the web interface. The API will be deployed on a specific stage (e.g.,prod
) and linked with the API Key to ensure that only valid requests are processed.
You need to complete the steps in section 3 (create Lambda functions getStudentData
, insertStudentData
, BackupDynamoDBAndSendEmail
, DynamoDB table studentData
, S3 bucket student-backup-20250706
, SES email verification). Ensure your AWS account is set up, and the AWS region is us-east-1
.
Below are the specific steps to configure the RESTful API:
Step | Content | Description |
---|---|---|
4.1 | Create a new REST API on API Gateway | Create a new REST API in AWS API Gateway to integrate with Lambda functions. |
4.2 | Create API Key to secure access | Create an API Key to secure API requests from the web interface. |
4.3 | Set up Usage Plan | Set up a Usage Plan to limit the number of API requests and manage access. |
4.4 | Create GET method to fetch data | Create a GET method for the /students endpoint to call the getStudentData function and retrieve student data. |
4.5 | Create POST method to store data | Create a POST method for the /students endpoint to call the insertStudentData function and store student information. |
4.6 | Create Resource & Method for data backup | Create a resource and POST method for the /backup endpoint to call the BackupDynamoDBAndSendEmail function. |
4.7 | Enable CORS to support frontend access | Enable CORS to support cross-origin requests from the web interface on CloudFront. |
4.8 | Deploy the API to a specific stage | Deploy the API to a stage (e.g., prod ) for use in the production environment. |
4.9 | Link API Key to Usage Plan & link with REST API and Stage | Link the API Key to the Usage Plan and stage to ensure only valid requests are processed. |
Note: Follow the steps in order to ensure the API is configured correctly. Each step will be detailed in the corresponding documentation.
By completing these configuration steps, you will have:
getStudentData
, insertStudentData
, BackupDynamoDBAndSendEmail
).Ready to proceed?
Go to Create a new REST API on API Gateway to start configuring the first API!