Currently, our AWS infrastructure has many instances which are attached to security groups, which I created in the console.
We are re-structuring our security groups with CloudFormation, thus we can have a comment and description in each rule.
My question is:
- When I create a new Security Group with CloudFormation, how can I add it to an existing EC2 instance, without removing the instance
- I saw some stack templates in AWS, but they only have a template to create a new Instance with a security group, so I have no idea how to create a stack for only security groups. And if I update the stack, does it apply to all instance immediately?
- How can I export current security groups to JSON, so I don't have to re-create all the security groups in CloudFormation?