AWS Fargate to Amazon Aurora Serverless

AWS Fargate → Aurora Serverless

Create an AWS Fargate service that interacts with Aurora Serverless

This project contains a sample AWS Cloud Development Kit (AWS CDK) template for deploying an AWS Fargate service running on an Amazon Elastic Container Service (ECS) cluster with an Application Load Balancer in-front.
The AWS Fargate service executes commands against an Amazon Aurora Serverless Cluster. This template uses a custom image without having to pre-push the image to Amazon Elastic Container Registry (ECR) or another container library.
This makes use of the in-built ecs.ContainerImage.fromAsset method. The custom image has a base route / for health checks, /createtable for adding a table to the database, and /showtables for displaying a list of tables in the database.
Environment variables like the database name, secrets ARN, and Aurora Serverless Cluster ARN are passed to the image to enable it to perform actions on the Database.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/fargate-aurora-serverless-cdk

Deploy

npm installcdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

1. Delete the stack: npx cdk destroy.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus".
3. You see a message confirming DELETE_COMPLETE.

Created by:

Glenn Chia Jin Wee

Glenn Chia Jin Wee

Glenn is an Associate Cloud Architect at AWS based in Singapore

Follow on LinkedIn