Functional/Architectural Requirements:
Deliver four backend endpoints (no front end, no HTML) that will be the start of user management for a new application. The endpoints shall create, read, update, and delete new users. The properties of a user object are left up to you. Enable appropriate authentication and validation on these endpoints. The user’s data shall be stored in DynamoDB with primary and sort keys named ‘_pk0’ and _’sk0’ respectively. Deployment of these APIs can be provided through your preferred Infrastructure-As-Code framework.
Required AWS services:
- API Gateway
- DynamoDB
Prohibited AWS services:
- Lambda
All other AWS services optional per your design.
Deliveries:
- IAC code to deploy.
- Instructions so we can deploy and test the solution.
- Postman file we can use to exercise the deployed endpoints
Currenlty configurations:
- API Gateway manage all endpoints
- Backend integration via AWS
- Authentication via IAM
- Validation via input mapping types
Future options:
- Find ways to simplify the endpoint infrastructure by better use of vars
- Determine if a Terraform module can replace any of the pile of resources used, for best practice
- Use tagging more consistenly
- Verify logging meets requirements
Because the design specified storing user data with primary and sort keys, it implies the primary key holds data in a one-to-many relationship, along with the sort key. The data to store was not specified, so I'll make some up.
Required:
- pk -
starship
(holds a crew) - sk - crewperson's
name
Optional:
email
addresssubscribed
to email updates
- DynamoDB module for user storage setup
- API Gateway-DynamoDB CRUD integrations, via the "AWS" integration type
- API Gateway endpoint configurations, authorization via "AWS_IAM" over a Lambda authorizer as per requirements
- Cloudwatch logging setup for debugging
- Various resources
- Deploy the Terraform
cd terraform terraform init && terraform apply
- Copy the
invoke_url
Terraform output - Open Postman and start a new request
- Paste in the URL
- Log into AWS and create a new access key in IAM (or use an existing one)
- In your Postman request, switch to the Authorization tab and select the
AWS Signature
type - Paste in the
AccessKey
andSecretKey
- Continue with further setup described in one of the CRUD methods below
Post requests create a new record.
- Request type is
POST
Content-Type
header isapplication/json
- Request body:
{ "starship": "NCC-1701-D", // required string (_pk0) "name": "Geordi", // required string (_sk0) "email": "geordi.laforge@ufp.org", // optional string "subscribed": true // optional bool }
Get requests return all the records in the table.
- Request type is
GET
- Request body is
none
Put requests update a record.
- Request type is
PUT
Content-Type
header isapplication/json
- Request body:
{ "starship": "NCC-1701-D", // required string (_pk0) "name": "Geordi", // required string (_sk0) "email": "geordi.laforge@enterprise.org", // string to update "subscribed": false // bool to update }
Delete requests remove a record.
- Request type is
DELETE
Content-Type
header isapplication/json
- Request body:
{ "starship": "NCC-1701-D", // required string (_pk0) "name": "Geordi" // required string (_sk0) }