AWS Fargate to Amazon SQS

AWS Fargate → SQS

Create an AWS Fargate service that interacts with SQS

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 makes sendMessage and receiveMessage calls to an Amazon Simple Queue Service (SQS) queue. 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, /sendmessage for adding to the queue and /readmessage for reading messages from the queue.
Environment variables like the SQS Queue URL and AWS region are passed to the image to enable it to perform actions on the SQS Queue.

< 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/sqs-fargate-cdk-python

Deploy

npm installcdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: npx cdk destroy.

Additional resources

Created by:

Gustavo Martim

Gustavo Martim

Cloud Application Architect at AWS.

Follow on LinkedIn