BOTO3 - Sicherheitsgruppe von EC2-Instanz anhängen / trennen
Wie kann ich eine bestimmte Sicherheitsgruppe von allen EC2-Instanzen trennen und sie dann einer neuen EC2-Instanz mit BOTO3 zuordnen?
Ich versuche etwas wie:
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 ???
Vielen Dank für jede Hilfe!