As a passionate advocate for automation, I have been using AWS CloudFormation since the first day I started migrating my applications to AWS. I need to manage my time efficiently and should not repeat myself. By applying automation in infrastructure provisioning and keeping my architecture as a code; I can save, test and re-use my work later.
Infrastructure as code is a key DevOps practice and AWS CloudFormation is your service on AWS to realize it. In this post I explain 11 reasons for using AWS CloudFormation and automating provisioning of your infrastructure.
Save your time, bring quality to your process by starting to prepare your CloudFormation templates today!
#1 - You can avoid human errors
I remember my OS classes at the university. At those times, we configured everything manually in Linux and once in a while we often forgot to apply a command and it was a nightmare. Believe me, you always forget some step when you do things manually even if you document them well. It was not be a big thing at my university years as I could retake the class if I had failed (glad that not). But, when you have workload in production it can be a disaster because you can lose customers, business or reputation at least which is far more important.
Now you have CloudFormation. You prepare your templates, validate, try, fail, correct in a repeating process until you succeed in your development/test environment. Then you can apply the same template in your staging environment once more and after making yourself sure that it will work, you can apply it to your production environment.
#2 - You can keep your architecture as code in your repository
When you use AWS CloudFormation, your infrastructure simply becomes a document or a collection of documents which can be kept in your code repository.
I generally use a dedicated repository for my templates in AWS CodeCommit, but you can keep them along side with your project in the same repository. When you need to remember, review or revert back to your previous architecture for some reason, you can find it in your repository history.
You can even create a CI/CD pipeline for your architecture using AWS CodePipeline and deploy changes to your AWS environment by Git pushes. Recently, we did this for one of my clients as he needed to update AppSync resolvers and schema more efficiently.
#3 - You can re-use your templates later to replicate the same environment
This makes you efficient and I love efficiency. Let’s say that you are a start up and need an AWS environment for the development of your new project. You can do it yourself or hire an AWS specialist like me to do the provisioning or your developer can tell you that she knew AWS; but whoever do this, everything is provisioned manually using AWS Management Console. You are happy at that time, your development process went well, 3 months passes and now you need a staging environment. Guess what? You need to repeat every work done in the new environment. Besides, it is a high probability that the errors encountered will be repeated, too. They often comes as a package when you do things manually.
Alternatively, whoever provisions your development environment, can prepare an AWS CloudFormation template and use it to create a new stack for your new environment within minutes.
#4 - You can save costs by deleting unused stacks and re-create them later
This is also related with previous benefits. Let’s say that you made progress in developing your project, but need to give a break due to some reason. If you use CloudFormation, you can simply take backups, delete your stack and recreate it later when you decide to continue. It saves you money, because you will not pay for your resources when they are idle. As it is simple, you will not hessitate to tear them down.
Similarly, you might have a project in production provisioning AWS environments for your clients and need to tear them down after their work is finished. You can use AWS CloudFormation templates for automating this process, too.
#5 - It is easy to learn if you can read/write YAML or JSON
You might find using AWS Management Console handy and I can really understand that. When you are trying a new service, AWS often provides a
Get Started feature and it is a viable option in the beginning. However, after deciding to use the service, you should switch to AWS CloudFormation templates because of the reasons I listed here and it is very easy to learn.
If you know YAML or JSON you can start writing templates right away. Even if you don’t, especially YAML is very easy to learn. It is simply key-value pairs with some indentation rules.
#6 - Your templates are self-explanatory
When I am working with a new client, if the provisioning was done using AWS CloudFormation, all I need is the template to understand what is there. Because templates are self-explanatory.
Also, when I am researching for some service and if AWS team provided a reference architecture template, it helps me a lot as I can use it to start and can read the contents to understand what they did. A CloudFormation template is a blueprint for your architecture and self-explanatory to everyone knowing how to read it.
#7 - It is free and a managed service
You do not pay for using AWS CloudFormation. You pay for the resources you provision as you do when you provision them manually. So, cost is not a paramater in this comparision.
In addition, AWS CloudFormation is a managed service and you don’t need to maintain the architecture behind it. This allows you to focus on only provisioning new resources by saving time from maintaining a centralized system for automated provisioning.
#8 - It is integrated with nearly all AWS services
When AWS launches a new service, they often provide AWS CloudFormation integration or they do this soon enough. Besides, AWS has a good documentation for supported services.
For example, AWS Serverless Application Model (SAM) is an extension of AWS CloudFormation which simplifies creating of serverless resources.
#9 - You have more control over the process
When you use AWS Management Console, you are mostly limited with what is provided from there. Some services AWS such as Elastic Beanstalk uses AWS CloudFormation templates behind the scenes, so do AWS Amplify, Mobile Hub, etc. But, all these services make assumptions on your behalf to simplify developing your applications on AWS. Sometimes, you need more control control over what you provision and how you do it.
You can extend Elastic Beanstalk environments by using .ebextensions. However, they are simply CloudFormation Cfn::Init features. Besides, if your architecture is getting more complex, the benefits of Elastic Beanstalk become less-apparent.
When you use AWS CloudFormation, you definitely have more control over provisioning and extending your architecture. Even if you use Elastic Beanstalk, you can create environments using CloudFormation templates to benefit from their re-usability advantages.
#10 - You become good at it as you progress and benefit more
As you use AWS CloudFormation more, you become good at it and start using its advanced features like custom resources, wait handlers, update policies. As you build more, you will start decoupling your templates into multiple sub-templates by using nested stacks feature.
Most probably, this will be sooner than you think.
#11 - When you become better, you will find it faster and simpler than manual provisioning
After you become good at AWS CloudFormation, you will realize that it is faster than manually creating everything one by one using AWS Management Console.
You can simply prepare a template and your stack will be ready in a few minutes instead of providing all inputs required by the GUI. The process will be faster and your work will be saved for re-using it when needed in the future.
Using AWS CloudFormation is a must if you would like to achieve operational excellency on AWS. It has many benefits and you can find more than I listed here. If you never used CloudFormation before, you should start considering to use it today. The work done will immediately payoff as it will be a reusable in the future and bring quality to your provisioning process.
Thanks for reading! If you need anything about AWS CloudFormation, please do not hessitate to contact me. I will be happy to help if I can.