Skip to content

/AWS1/CL_EC2=>CREATESECURITYGROUP()

About CreateSecurityGroup

Creates a security group.

A security group acts as a virtual firewall for your instance to control inbound and outbound traffic. For more information, see Amazon EC2 security groups in the Amazon Elastic Compute Cloud User Guide and Security groups for your VPC in the Amazon Virtual Private Cloud User Guide.

When you create a security group, you specify a friendly name of your choice. You can't have two security groups for the same VPC with the same name.

You have a default security group for use in your VPC. If you don't specify a security group when you launch an instance, the instance is launched into the appropriate default security group. A default security group includes a default rule that grants instances unrestricted network access to each other.

You can add or remove rules from your security groups using AuthorizeSecurityGroupIngress, AuthorizeSecurityGroupEgress, RevokeSecurityGroupIngress, and RevokeSecurityGroupEgress.

For more information about VPC security group limits, see Amazon VPC Limits.

Method Signature

IMPORTING

Required arguments:

IV_DESCRIPTION TYPE /AWS1/EC2STRING /AWS1/EC2STRING

A description for the security group.

Constraints: Up to 255 characters in length

Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*

IV_GROUPNAME TYPE /AWS1/EC2STRING /AWS1/EC2STRING

The name of the security group.

Constraints: Up to 255 characters in length. Cannot start with sg-.

Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*

Optional arguments:

IV_VPCID TYPE /AWS1/EC2VPCID /AWS1/EC2VPCID

The ID of the VPC. Required for a nondefault VPC.

IT_TAGSPECIFICATIONS TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST TT_TAGSPECIFICATIONLIST

The tags to assign to the security group.

IV_DRYRUN TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

RETURNING

OO_OUTPUT TYPE REF TO /AWS1/CL_EC2CREATESECGROUPRSLT /AWS1/CL_EC2CREATESECGROUPRSLT