I have created a new EC2 instance. It got assigned the default security group. I want to change that security group. How?

link|improve this question

35% accept rate
possible duplicate of How to add a security group to a running EC2 Instance? – Iain Feb 19 '11 at 10:58
Not exactly. I STOP the instance but still cannot change the security group. But it appears that an instance's security group cannot be changed once the instance is launched, that is, if you assign security group secA to the instance, you cannot later change that instance's security group to secB. I have not found an AWS document that explicitly states this, though. – user35042 Feb 19 '11 at 17:20
Documentation on the topic can be found here: docs.amazonwebservices.com/AWSEC2/latest/UserGuide/… (see the note under the "Adding a Security Group Rule" section) – steenhulthin Mar 16 at 9:13
feedback

3 Answers

up vote 10 down vote accepted

you can not. security groups can only be chosen when you start your instance.

Only VPC instances can change security group. For information on VPC see here.

link|improve this answer
As Vitaly says: "After an instance is running, you can't change which security groups it belongs to." (cited from the reference documentation). You could take a snapshot / AMI from the instance and launch it with a different security group, though. – Axel Knauf Feb 21 '11 at 12:50
3  
Thanks for the reference, Axel. Although I know you are correct, the wording in the documentation is rather ambiguous: "After an instance is running, you can't change which security groups it belongs to." This suggested to me that if you stopped the instance you could then change the security group. A better way to word this would have been "After an instance has run for the first time, you can't change which security groups it belongs to." – user35042 Feb 22 '11 at 6:40
feedback

It can be changed now http://elastic-security.com/2011/04/19/amazon-security-groups-vpc-vs-ec2/

link|improve this answer
1  
It can only be changed for VPC. – steenhulthin Mar 16 at 9:19
feedback

For instances launched without a VPC, the Security Group can only be specified at first launch, and cannot be changed afterwards, not even if the instance is stopped first.

For instances launched into a VPC, the group can be changed. However, not all instance types are supported in the VPC - for example, "micro" is not supported as of December 2011.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.