You can change the security group assigned to an instance. This allows you to maintain a set of security groups for different purposes and to flexible switch which security group an instance is currently using. See Changing the security group.
Sign in to your AWS account. Click Services and select EC2.
In the navigation tree on the left select InstancesInstances.
Select the instance for which you want to change the security group.
Click Actions and select NetworkingChange Security Groups.
Select the security group that you want the virtual machine to use and click Assign Security Groups.