This directory modifies the basic Spring Boot application to work inside Lambda with SnapStart enabled.
Copy etc/environment.template
to etc/environment.sh
and update accordingly.
PROFILE
: your AWS CLI profile with the appropriate credentials to deployBUCKET
: your configuration bucketP_NAME
: naming prefix for resourcesP_STAGE
: stage for API GatewayP_FN_MEMORY
: memory configuration in MBP_FN_TIMEOUT
: timeout configuration in secondsP_FN_ALIAS_NAME
: name to use for the function aliasP_FN_SNAPSTART_APPLY_ON
:None
to disable SnapStart orPublishedVersions
to enable it
For the infrastructure stack, update the following accordingly.
P_VPC_ID
: your VPC idP_HOSTEDZONE_DOMAIN
: root domain name for the private hosted zoneP_DOMAINNAME
: domain name to be used for your certificate and alias for the load balancer.
For your hosted zone domain, you'll want to create a private domain off the public domain that you own. For example, heeki.cloud is the public hosted zone that is owned with this eample. Thus, P_HOSTEDZONE_DOMAIN
is then configured as internal.heeki.cloud. For your domain name, you'll create an ACM certificate to be used as a custom domain name.
Deploy the infrastructure resources using makefile
: make infrastructure
After completing the deployment, update the following outputs:
O_HOSTEDZONE_ID
: output hosted zone idO_CERT_ARN
: output certificate ARN
Deploy the DynamoDB table: make ddb
After completing the deployment, update the following outputs:
O_TABLE_ARN
: output DynamoDB table ARN
Deploy the Lambda and API Gateway resources: make lambda
After completing the deployment, update the following outputs:
O_FN
: output Lambda function idO_API_ENDPOINT
: output API Gateway endpoint URL, e.g. https://<api_id>.execute-api..amazonaws.com/
To create a customer record and retrieve a list of all customer records:
mkdir tmp && cat > tmp/customer.json << EOF
{
"given_name": "Jack",
"family_name": "Doe",
"birthdate": "1960-03-03",
"email": "jack.doe@heeki.cloud",
"phone_number": "+15551234567",
"phone_number_verified": true
}
EOF
curl -s -XPOST -H "content-type:application/json" -d @tmp/customer.json https://<api_id>.execute-api.<region>.amazonaws.com/<stage>/customer
curl -s -XGET https://<api_id>.execute-api.<region>.amazonaws.com/<stage>customer