Configuration Management of EC2 Instances Using cfn-init
There are multiple ways to manage the configuration of your EC2 instances and applications on AWS. There is UserData
, a basic shell script that runs during the launch of an EC2 instance. You can use configuration management systems, such as Ansible, Puppet, Chef, and SaltStack, to manage your resources. AWS provides a service called OpsWorks—a managed Chef or Puppet server.
We are going to learn about cfn-init
(CloudFormation’s own configuration management tool) and how can we use it to deploy applications on EC2 resources. We are going to cover cfn-init
along with AWS::CloudFormation:Init
, CloudFormation’s metadata key, which actually declares configuration items for EC2 resources.
In this chapter, we will cover the following topics:
- Introducing
cfn-init
- Deploying your application on EC2 during stack creation
- Using
cfn-signal
to inform CloudFormation of resource readiness