85

How do you change the name and description of a security group in AWS EC2?

My security group is named quick-start-1 (the default) and I want to change it to "HTTP, HTTPS and Limited SSH".

1
  • 14
    Can't even change the description! What stupidity is this, Amazon?
    – ADTC
    Jan 3, 2016 at 2:25

4 Answers 4

39

It's not possible to rename a security group, by GUI or by API.

For VPC EC2 instances

You can dynamically assign security groups assigned to VPC EC2 instances. Create a new SG with the desired name and the same rules.

EC2 classic instances

It's not possible to change the security group that is assigned to EC2 classic instances.

If you must change the security group for an EC2 classic instance, then you need to:

  1. Create an AMI from your instance, then
  2. Launch a new copy of your instance from the AMI created in step #1, selecting the new security group at launch time.
7
  • 15
    Not entirely correct. If you use a VPC (and why wouldn't you) you can change assigned SGs dynamically.
    – EEAA
    Jan 7, 2013 at 4:00
  • 5
    wonderful ridiculousness... Mar 16, 2014 at 10:04
  • 3
    You can choose to copy the security group. Then you are given the possibility to give the new security group a new name and a new description.
    – fredrik
    Jul 2, 2014 at 7:14
  • 3
    All AWS accounts can use VPC. Jun 22, 2015 at 15:37
  • 1
    The renaming can be done by copying an existing security group to a new one, changing instance security group to the latter and then removing the previous security group.
    – demisx
    Feb 7, 2019 at 0:06
59

You cannot rename a security group but you can copy it into a new one.

On the AWS console go to EC2 -> Security Groups -> Select the SG -> Click actions -> Copy to new.

Give it a name and description that suits your taste.

After that you can associate this security group with your instances (making it redundant with the old one).

Finally, dissociate the old security group from your instances (rules remains the same since the new SG is a copy) and delete the SG.

It is a little bit of work, but it does get the job done with no downtime.

5
  • 2
    ...only works with VPC instances, "classic" instances can't do this.
    – Dan Pritts
    Jun 22, 2015 at 15:12
  • This should be the accepted answer, not sure why anyone uses EC2 classic these days anyhow Mar 31, 2016 at 9:56
  • Unfortunately, you're REQUIRED to change the name in this case. If you only want to change the description, you have to copy to a new one, update all references, delete the old one, and then do it all again with another copy with the original name.
    – James
    Jun 19, 2017 at 22:53
  • 1
    Not to forget that you will also need to grep all your sources for usages of "old" security group and replace with ID/name of the new one (if you have some scripts for automation, etc.)
    – Tim
    Apr 13, 2018 at 19:21
  • 1
    Best Answer for most folks/use cases. Oct 25, 2018 at 17:36
6

You're not the first to want this, and you're not the first to be disappointed.

Also, you cant change security group memberships for an instance once launched. :-(

I'm 99% sure this cant be done via the web GUI. Maybe via API shenanigans, but if so i've never seen it. I've wanted it myself often enough.

2
  • 10
    As mentioned above, if in a VPC, you can change security group assignments as needed at any time. It's only non-VPC instances that have this restriction.
    – EEAA
    Jan 7, 2013 at 4:02
  • Yes, sorry I should have made that point.
    – Sirex
    Jan 7, 2013 at 18:42
3

2022's answer.

Actually, You cannot rename the SG name. You can follow the steps of FlavioMuratore's answer to copy the old group into a new one.

After that, you can Change SG like this

Right click your instance --> Security --> Change Security Group. enter image description here

Then you can remove or add any SG as your needs without downtime. enter image description here

5
  • This duplicates the existing, long-standing answers.
    – ceejayoz
    Aug 31, 2022 at 4:35
  • 1
    I dont think so. I've provided the way to change SG after you clone the old one. Aug 31, 2022 at 6:07
  • The first answer says "You can dynamically assign security groups assigned to VPC EC2 instances"; the second says "After that you can associate this security group with your instances".
    – ceejayoz
    Aug 31, 2022 at 16:30
  • 2
    For me, It's hard to find out a way to change SG. Furthermore, "An image worth a thousand words" @ceejayoz Aug 31, 2022 at 16:32
  • 2
    Why downvote a new contributor's answer that clearly adds new detail is beyond me? Thanks @NguyễnVănPhong, +1 from me.
    – LMSingh
    Oct 25, 2022 at 23:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .