如何将 EC2 实例添加到新创建的安全组?安全组创建于
client = session.client("ec2")
group_id = client.create_security_group(
DryRun=False,
GroupName=group_name,
VpcId=vpc_id,
Description=description
)
请您参考如下方法:
您将要修改实例的属性:
modify_attribute(attribute, value, dry_run=False)
modify_attribute 更改此实例的属性。使用属性 groupSet - 安全组或 ID 集
i.modify_attribute('groupSet','sg-xxxx5678')
