CmdID

CmdID / aws / aws ec2

aws ec2 create-security-group

Creates a security group. AWS CLI reference

2 examples 5 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To create a security group for EC2-Classic

The following create-security-group example creates a security group named MySecurityGroup.

aws ec2 create-security-group --group-name MySecurityGroup --description "My security group"Identify
--group-nameThe name of the security group.
--descriptionA description for the security group.
Its output
{
    "GroupId": "sg-903004f8"
}

For more information, see Amazon EC2 security groups for your EC2 instances in the Amazon EC2 User Guide.

Example 2: To create a security group for EC2-VPC

The following create-security-group example creates a security group named MySecurityGroup for the specified VPC.

aws ec2 create-security-group --group-name MySecurityGroup --description "My security group" --vpc-id vpc-1a2b3c4dIdentify
--group-nameThe name of the security group.
--descriptionA description for the security group.
--vpc-idThe ID of the VPC.
Its output
{
    "GroupId": "sg-903004f8"
}

For more information, see Creating, configuring, and deleting Amazon EC2 security groups in the AWS CLI in the AWS Command Line Interface User Guide.

Options

5 in the AWS CLI reference
--descriptionA description for the security group.
--dry-runChecks whether you have the required permissions for the action, without actually making the request, and provides an error response.
--group-nameThe name of the security group.
--tag-specificationsThe tags to assign to the security group.
--vpc-idThe ID of the VPC.