0

Is it possible to attach a new security group to all the EC2 instances in a specific region and keeping the old ones in place?

Volodymyr Molodets
  • 2,424
  • 9
  • 36
  • 52
  • It should be possible to script this using the CLI. – ceejayoz Jan 29 '19 at 15:14
  • Yes, that's what I was trying to do: get the list of EC2 instance and then modify SG list? But the question is still valid - will the existing ones be preserved during the modification or will be dropped? – Volodymyr Molodets Jan 29 '19 at 15:23
  • 2
    You'll need to loop through the instances, get their current SG settings, and add to that. The CLI appears to expect the full list. – ceejayoz Jan 29 '19 at 15:25
  • Again, for volume: ***The CLI expects the full list of ALL SGs for the instance.*** If you only give it one SG that will be the _only_ SG on the instances and you'll have to go back through and add your SGs back like I did. – Sammitch Jan 12 '21 at 19:10

0 Answers0