cloudformation

Display AWS Cloudformation logs in pipelines

Using cloudformation is great, it gives you insane super powers but there are some small things that annoy me when using it in pipelines. My biggest issue is that it is not displaying the steps it takes in kind of real time’ish to stdout, so that’s where the following snippet will help. The code What the output looks like [ { "StackId": "arn:aws:cloudformation:eu-west-1:368341477005:stack/tech-blog/2b819be0-28fe-11ea-8ab3-06e58f87e324", "EventId": "5816a850-3333-11ea-83e6-02bbe9b74d60", "StackName": "tech-blog", "LogicalResourceId": "tech-blog", "PhysicalResourceId": "arn:aws:cloudformation:eu-west-1:368341477005:stack/tech-blog/2b819be0-28fe-11ea-8ab3-06e58f87e324", "ResourceType": "AWS::CloudFormation::Stack", "Timestamp": "2020-01-09T22:57:00.

Mass delete cloudformation stacks

The oneliner: # This will delete all stacks in the account connected to yourprofile with the string "delete-me" in the stackname for StackName in $(aws --profile yourprofile cloudformation list-stacks --query 'StackSummaries[?contains(StackName, `delete-me`) == `true`] .StackName' --output text); do echo $StackName ; aws --profile yourprofile cloudformation delete-stack --stack-name $StackName ; done

Cloudformation & Autoscaling

In this session we'll take a look at Cloudformation the Infra As Code language for AWS and how to use it to build endlessly scalable infrastructure and make sure your stack can handle anything.

Cloudformation and auto scaling, from the concepts to the details

Before you start Not every environment is ready for auto scaling, to be able to fully utilize these techniques your infra must comply with the following. No local state on the disks of application servers. Redeployable images: ec2 asg/spot fleet (ami) or in the case of ecs you need docker images. In case you want something to get started with, I would recommend using the linked below “hello world” docker image to get familiar with the way of working.

Add target tracking auto scale to your aws ecs service

This cloudformation snippet will add auto scale to your existing cloudformation based ecs service. To connect it to your service you may need to edit the folowing vars ServiceScalingTarget: Service This is the name of the cloudformation block that defines your ecs service Ref: ContainerCluster This should pull in the ecs cluster name I define this in a param: ContainerCluster ApplicationAutoScalingRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Effect: Allow Principal: Service: [application-autoscaling.