| Did this page help you? Yes No Tell us about it... |
Creates a new security group. You can create either an EC2 security group (which works only with EC2), or a VPC security group (which works only with Amazon Virtual Private Cloud). The two types of groups have different capabilities. For information about VPC security groups and how the two types of groups differ, go to Security Groups in the Amazon Virtual Private Cloud User Guide. For information about EC2 security groups, go to Using Security Groups in the Amazon Elastic Compute Cloud User Guide.
When you create a security group, you give it a friendly name of your choice. You can have an EC2 security group with the same name as a VPC security group (each group has a unique security group ID separate from the name). Two standard groups can't have the same name, and two VPC groups can't have the same name.
If you don't specify a security group when you launch an instance, the instance is launched into the default security group. This group (and only this group) includes a default rule that gives the instances in the group unrestricted network access to each other. You have a default EC2 security group for instances you launch with EC2 (i.e., outside a VPC), and a default VPC security group for instances you launch in your VPC.
You can add or remove rules from your security groups (i.e., authorize or revoke
permissions) using the AuthorizeSecurityGroupIngress,
AuthorizeSecurityGroupEgress,
RevokeSecurityGroupIngress, and
RevokeSecurityGroupEgress actions.
![]() | Important |
|---|---|
For EC2 security groups: You can have up to 500 groups. For VPC security groups: You can have up to 50 groups per VPC. |
| Name | Description | Required |
|---|---|---|
|
|
Name of the security group. Type: String Default: None Constraints: Accepts alphanumeric characters, spaces, dashes, and underscores. |
Yes |
|
|
Description of the group. This is informational only. Type: String Default: None Constraints: Accepts alphanumeric characters, spaces, dashes, and underscores. |
Yes |
|
|
ID of the VPC. Type: String Default: None Condition: Required for VPC security groups |
Conditional |
The elements in the following table are wrapped in a
CreateSecurityGroupResponse structure.
| Name | Description |
|---|---|
|
|
The ID of the request. Type: xsd:string |
|
|
Returns true if the request succeeds. Otherwise, returns an error. Type: xsd:boolean |
|
|
ID that AWS assigns to the security group. Type: xsd:string |
This example creates the websrv security group.
https://ec2.amazonaws.com/?Action=CreateSecurityGroup &GroupName=websrv &GroupDescription=Web Servers &AUTHPARAMS
<CreateSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <return>true</return> <groupId>sg-1a2b3c4d</groupId> </CreateSecurityGroupResponse>