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 EC2 User Guide and Security groups for your VPC in the Amazon VPC 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 .
See also: AWS API Documentation
create-security-group
--description <value>
--group-name <value>
[--vpc-id <value>]
[--tag-specifications <value>]
[--dry-run | --no-dry-run]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]
[--cli-error-format <value>]
--description (string) [required]
A description for the security group.
Constraints: Up to 255 characters in length
Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
--group-name (string) [required]
The name of the security group. Names are case-insensitive and must be unique within the VPC.
Constraints: Up to 255 characters in length. Can’t start with
sg-.Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
--vpc-id (string)
The ID of the VPC. Required for a nondefault VPC.
--tag-specifications (list)
The tags to assign to the security group.
(structure)
The tags to apply to a resource when the resource is being created. When you specify a tag, you must specify the resource type to tag, otherwise the request will fail.
Note
TheValid Valueslists all the resource types that can be tagged. However, the action you’re using might not support tagging all of these resource types. If you try to tag a resource type that is unsupported for the action you’re using, you’ll get an error.ResourceType -> (string)
The type of resource to tag on creation.
Possible values:
capacity-reservationclient-vpn-endpointcustomer-gatewaycarrier-gatewaycoip-pooldeclarative-policies-reportdedicated-hostdhcp-optionsegress-only-internet-gatewayelastic-ipelastic-gpuexport-image-taskexport-instance-taskfleetfpga-imagehost-reservationimageimage-usage-reportimport-image-taskimport-snapshot-taskinstanceinstance-event-windowinternet-gatewayipamipam-poolipam-scopeipv4pool-ec2ipv6pool-ec2key-pairlaunch-templatelocal-gatewaylocal-gateway-route-tablelocal-gateway-virtual-interfacelocal-gateway-virtual-interface-grouplocal-gateway-route-table-vpc-associationlocal-gateway-route-table-virtual-interface-group-associationnatgatewaynetwork-aclnetwork-interfacenetwork-insights-analysisnetwork-insights-pathnetwork-insights-access-scopenetwork-insights-access-scope-analysisoutpost-lagplacement-groupprefix-listreplace-root-volume-taskreserved-instancesroute-tablesecurity-groupsecurity-group-ruleservice-link-virtual-interfacesnapshotspot-fleet-requestspot-instances-requestsubnetsubnet-cidr-reservationtraffic-mirror-filtertraffic-mirror-sessiontraffic-mirror-targettransit-gatewaytransit-gateway-attachmenttransit-gateway-connect-peertransit-gateway-multicast-domaintransit-gateway-policy-tabletransit-gateway-metering-policytransit-gateway-route-tabletransit-gateway-route-table-announcementvolumevpc