Creating and configuring AWS services and resources through a management console is a manual process. Where possible, we should automate the provisioning, termination, and configuration of resources.
Infrastructure As a Code
When we come to cloud, we always heard about something as a service. But recently the trend changes a little bit. We will talk something as a code instead, like infrastructure as a code (IaaC). So, what is IaaC? Techniques, practices, and tools from software development applied to creating reusable, maintainable, extensible and testable infrastructure.
In fact, we could build and operate our infrastructure like software.
When we have a template, we can use it when and where.
How Should Resources be Grouped Together Into Templates?
We recommend to assign resources to CloudFormation templates based on ownership and application lifecycles. At a minimum separate network resources, security resources, and application resources into their own templates.
For instance, a network resource template called “NetworkSharedTierVpcIgwNat.template” may include definitions for VPCs, subnets, IGWs, route tables, ACLs and so on.
We avoid sharing a single template across applications.
Alternative of CloudFormation
In fact, there are some automation services other than CloudFormation.
AWS Elastic Beanstalk
AWS Elastic Beanstalk is an automated deployment and scaling service for web applications. It supports Java, .NET, PHP, Node.js, Python, Go those popular languages. Also, it is able to deploy on Apache, Nginx, IIS Servers and so on.
When we use AWS Elastic Beanstalk, it can help us handle load balancing, health monitoring, auto scaling, application platform management and code deployment.
AWS OpsWorks is a configuration management service that helps us configure and operate applications of all shapes and sizes using Chef.
What we need is to define the application’s whole architecture and specifications like package installation, software configuration and resources.
We usually start from templates for common technologies (app servers, databases and so on) or build our own. In addition, we use AWS OpsWorks as a lifecycle tool to simplify management of an application and reduce the number of deployment cycles.
Amazon EC2 Run Command
EC2 Run command enables us to securely manage the configuration of EC2. It provides a simple way to automate common administrative tasks like executing shell scripts and commands on Linux or PowerShell on Windows. Installing software or patches, and document management and sharing.
If we want, we could execute commands across multiple instances and offers visibility into the results.
There are some ways for automation. We can build all the automation by ourselves. Or we could out source the automation as much as possible. It is up to you to choose any approaches and depends on your own situation.