Deploy CloudFormation Stacks

...
  • CloudFormation
  • AWS
  • LocalStack
About 3 min

# Deploy CloudFormation Stacks

CloudFormation stacks provide descriptions in json or yaml of your infrastructure in AWS. They are a crucial component of IaC (Infrastructure as Code) and allow you to build repeatable systems.

Up until now, this had to all be done from wither the AWS console or the command line. But now, with Commandeer, you can run your deployments with the click of a button, allowing you to quickly test out new ideas.

To get started, simply download Commandeer here. You can also download pre-made templates from AWS here, to get started with building the infra of your dreams.

# CloudFormation Runner

The runner in Commandeer is setup much like the other runners in the system. On the left hand side you put in your template and press the deploy button. Then on the right hand side, there is the results of your run.

CloudFormation Runner


# Setup

You can either create a new stack from scratch, update an existing stack, or attempt to copy over a stack from another account. Note: copying a stack over from another will not always work. This is especially true if you are using something like Serverless Framework to deploy the stack, as it might require source code for Lambda's to be copied over. In that case you will want to use the Serverless Framework runner in Commandeer. But if your stack is simply setting up resources like S3 buckets or SQS queues, you may be able to simply import the stack template and run it.

# Select Type

  • New stack - this allows you to give your new stack a name, and then either copy and paste a template or write a new one from scratch.

Create new stack

  • Update existing stack - if you already have a stack in your environment, you can select it here. Note: if you just deploy it with no changes, you will get an error, so this is really meant to select the template, and then add your changes in.

Update existing stack

  • Import from another account - you can easily choose a different account and then select a stack from it to run. Your mileage may vary on this, but it is a really cool way to try to get a stack running on AWS up and running on LocalStack for instance.

Import from another account

# Enter Template

The template is then either imported from the above selection, or you can type it in. There is a handy validate button, that will validate it to see if there are any common errors, like a missing } bracket or things like that. Under the hood it uses the AWS CloudFormation validate function.

Enter template


# Results

Once you have your template how you like it. You can then press the deploy button and voila, your IaC code will begin to deploy to your AWS or LocalStack environment. There is a main Deploy Status tab as well as a more thorough breakdown of your stack in the Stack Details tab.

# Deploy Status

There are 3 different states that the deployment can be in

  • Processing - this is the first phase, which will either show Processing... or one of the many states of the stack such as 'Update in Progress...' or 'Create in Progress...'

Deployment Processing

  • Complete - if the deploy is a success it will either show 'Create Complete' or 'Update Complete'

Deployment Complete

  • Error - if an error with the deployment occurs then you will see an error with a message of what fails.

Deployment Error

# Stack Details

If you want to get further information about the stack, you can click on this tab. It will not only show you the high-level information about the stack, but also allow you to see each individual resource and what the current status of deployment of it is. This can be realyl helpful for long running deployments, because certain resources in AWS can tak e awhile to deploy.

Stack Details


# Conclusion

CloudFormation is an important feature of AWS. It allows you to have a system that you know you can recreate easily in other environments. This runner will help tremendously in helping you test out your IaC code so you can be sure that your infra is rock solid.

Last update: May 10, 2022 13:39