- Newest
- Most votes
- Most comments
Thanks for your reply @Manu :)
I took a look at the command you mentioned, looks like it replaces all the currently associated SGs with a list of SGs, as specified like this:
aws ec2 modify-network-interface-attribute --network-interface-id <NIC ID> --groups <SG ID 1> <SG ID 2> <SG ID 3>
Is that right? i'm not sure how I'd 'replace' the old SG with a new one using the command as I wouldn't be specifying the <old SG ID>.... However, looks like I could use the command to associate all the SGs I want to keep... Question is, would this work better than trying to remove the SG from the NIC via the console!? What do you think?
Ideally want to avoid having to stop any live Elasticache instances. Hmm, I'm not sure if that's supported?
You can try removing the association between the security group and the network interface by modifying the network interface's attributes.
aws ec2 modify-network-interface-attribute --network-interface-id <NIC ID> --groups <new SG ID>
This command removes the specified security group from the network interface and replaces it with a new security group. You can create a new temporary security group and use its ID in place of <new SG ID> to replace the original security group.
You can try stopping or terminating any Elasticache instances associated with the network interface, which should release the network interface and allow you to delete the security group.
Once you have resolved any dependencies on the network interface, you should be able to delete the security group without encountering any errors.
Relevant content
- asked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated 7 days ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 8 months ago
Yes, you are correct. The
modify-network-interface-attribute
command replaces all the currently associated security groups with a new list of security groups. You won't be specifying the old security group ID directly.If you want to remove a specific security group from the network interface, you can do so by specifying all the other security groups except for the one you want to remove, like this:
This will replace the current set of security groups on the network interface with the new list you specify, without including the security group that you want to remove.
Regarding whether it's better to remove the security group from the network interface via the console or via the command line, both options should work. It ultimately depends on your preference and what you are comfortable with.
You can detach the security group without stopping the Elasticache instances. Under the Network and Security tab of Elasticache (Redis), you have the option to add or remove security groups.