I am exploring options for using CloudFormation for creating a jump box and wondering if it is possible to run userdata in cloudformation at launch to install software and updates (security group needing HTTP access), and then remove HTTP from the security group once the user data script has completed.
So, I would like to explore if it's possible to add a security group to ec2 at launch with HTTP access required to install packages with yum/apt then remove that security and/or the HTTP rule after the ec2 resource has been created.
I'm aware that usually an AMI is configured first but I am exploring if it is possible to do so without a preconfigured AMI.
Thanks