How can I go about disassociating a particular security group from all EC2 instances and then associate it with a new EC2 instance, with BOTO3?
I'm trying something like:
ec2 = boto3.resource('ec2')
instances = ec2.instances.filter()
for instance in instances:
print(instance.id, instance.instance_type)
for sg in instance.security_groups:
if sg['GroupId'] == sg_id:
instance.modify_attribute ???
Thanks for any help!