I was looking into the difference between using cfn-init and userdata. I understand from various documentations that with cfn-init, making changes to the stack does not replace the ec2 instance and just updates the configuration changes to the existing ec2 instance.
Can someone please clarify what type of configuration changes is the documentation referring to here?
I am using AWS::CloudFormation::Init in my cloud formation template to install softwares and create new files and services. The stack runs successfully without any issues and all softwares and services are getting installed.
When I tried creating a new file in the AWS::CloudFormation::Init section, and update the stack, the new file does not get created.
Below is the new content added to the CFT template.
"/tmp/hello.html":
content:
Fn::Join:
- ''
- - "#!/bin/bash \n"
- "Checking if this file is created \n"
mode: '000755'
owner: root
group: root
I expect the new file to be created but I don't see it created. Hence, what kind of changes does cfn-init can detect and apply?