[{"data":1,"prerenderedAt":77},["ShallowReactive",2],{"pattern-cdk-fargate-sns-sqs":3},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":13,"deploy":15,"description":18,"extension":19,"framework":20,"gitHub":21,"highlight":6,"introBox":30,"language":35,"level":36,"meta":37,"patternArch":38,"resources":56,"s3URL":6,"services":70,"stem":71,"testing":72,"videoId":29,"__hash__":76},"patterns\u002Fpatterns\u002Fcdk-fargate-sns-sqs.json","AWS Fargate to Amazon SNS to Amazon SQS",null,{"headline":8,"text":9},"Cleanup",[10,11,12],"1. Delete the stack: \u003Ccode>npx cdk destroy\u003C\u002Fcode>.","2. Confirm the stack has been deleted: \u003Ccode>aws cloudformation list-stacks --query \"StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus\"\u003C\u002Fcode>.","3. You see a message confirming DELETE_COMPLETE.",[14],"content\u002Fcontributors\u002Farun-thangaraj.json",{"text":16},[17],"cdk deploy","Create an AWS Fargate service that sends to SNS then SQS","json","AWS CDK",{"template":22,"payloads":27},{"projectFolder":23,"repoURL":24,"templateURL":25,"templateFile":26},"fargate-sns-sqs-cdk","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Ffargate-sns-sqs-cdk","serverless-patterns\u002Ffargate-sns-sqs-cdk","cdk\u002Flib\u002Fcdk-stack.ts",[28],{"headline":29,"payloadURL":29},"",{"headline":31,"text":32},"How it works",[33,34],"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 publish call to an Amazon Simple Notification Service (SNS) and receiveMessage call to an Amazon Simple Queue Service (SQS) queue which is subscribed to the SNS topic that the template creates. 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 \u002F for health checks, \u002Fpublishmessage for adding to the queue and \u002Freadmessage for reading messages from the queue. Environment variables like the SQS Queue URL, SNS Topic ARN and AWS region are passed to the image to enable it to perform actions on the SNS Topic and SQS Queue.","This project also shows how to set up an SNS and SQS Interface Endpoint to the VPC. A VPC Endpoint policy is created to only allow the Fargate task definition to perform actions through the VPC endpoint. In addition, an access policy is set on the SNS topic and SQS queue to deny requests that are not from the created Interface Endpoint.","TypeScript","200",{},{"icon1":39,"icon2":44,"icon3":47,"line1":51,"line2":54},{"x":40,"y":41,"service":42,"label":43},20,50,"fargate","AWS Fargate",{"x":41,"y":41,"service":45,"label":46},"sns","SNS",{"x":48,"y":41,"service":49,"label":50},80,"sqs","SQS",{"from":52,"to":53,"label":29},"icon1","icon2",{"from":53,"to":55,"label":29},"icon3",{"headline":57,"bullets":58},"Additional resources",[59,61,64,67],{"text":43,"link":60},"https:\u002F\u002Faws.amazon.com\u002Ffargate\u002F",{"text":62,"link":63},"Amazon SNS","https:\u002F\u002Faws.amazon.com\u002Fsns\u002F",{"text":65,"link":66},"CDK documentation for SNS","https:\u002F\u002Fdocs.aws.amazon.com\u002Fcdk\u002Fapi\u002Fv1\u002Fdocs\u002Faws-sns-readme.html",{"text":68,"link":69},"CDK documentation for SQS","https:\u002F\u002Fdocs.aws.amazon.com\u002Fcdk\u002Fapi\u002Flatest\u002Fdocs\u002Faws-sqs-readme.html",{"from":42,"to":49},"patterns\u002Fcdk-fargate-sns-sqs",{"headline":73,"text":74},"Testing",[75],"See the GitHub repo for detailed testing instructions.","IfXNLGpzn5mEaJCJCCpLsfmNkjwCkKNUDEmqp7pgZZA",1779273334116]