I have an ec2.SecurityGroup that I'd like to delete all rules from. I am having trouble removing the default ingress rule for the group, where the source is the security group's ID:
I do so this way, using the Go SDK:
for _, perm := sg.IpPermissions {
for _, pair := range perm.UserIdGroupPairs {
service.RevokeSecurityGroupIngress(&ec2.RevokeSecurityGroupIngressInput{
SourceSecurityGroupName: pair.GroupId,
IpProtocol: perm.IpProtocol,
SourceSecurityGroupOwnerId: pair.UserId,
GroupId: sg.GroupId,
});
}
}
However, this produces an error: "VPCIdNotSpecified: No default VPC for this user".
How am I supposed to revoke this rule, and ALL others? Go is preferred in answers but a way to accomplish this in any language would be appreciated.
