I know that it's possible to use a CloudFormation template to launch a new EC2 instance in AWS and install any packages using user data.
But is there any way to connect to an existing instance and execute a shell file using the CloudFormation template?