amazonka-ec2-2.0: Amazon Elastic Compute Cloud SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.EC2.CreateSecurityGroup

Description

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 have a security group for use in EC2-Classic with the same name as a security group for use in a VPC. However, you can't have two security groups for use in EC2-Classic with the same name or two security groups for use in a VPC with the same name.

You have a default security group for use in EC2-Classic and 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.

We are retiring EC2-Classic. We recommend that you migrate from EC2-Classic to a VPC. For more information, see Migrate from EC2-Classic to a VPC in the Amazon Elastic Compute Cloud User Guide.

Synopsis

Creating a Request

data CreateSecurityGroup Source #

See: newCreateSecurityGroup smart constructor.

Constructors

CreateSecurityGroup' 

Fields

  • dryRun :: Maybe Bool

    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.

  • tagSpecifications :: Maybe [TagSpecification]

    The tags to assign to the security group.

  • vpcId :: Maybe Text
    EC2-VPC
    The ID of the VPC. Required for EC2-VPC.
  • description :: Text

    A description for the security group. This is informational only.

    Constraints: Up to 255 characters in length

    Constraints for EC2-Classic: ASCII characters

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

  • groupName :: Text

    The name of the security group.

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

    Constraints for EC2-Classic: ASCII characters

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

Instances

Instances details
ToHeaders CreateSecurityGroup Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

ToPath CreateSecurityGroup Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

ToQuery CreateSecurityGroup Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

AWSRequest CreateSecurityGroup Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

Associated Types

type AWSResponse CreateSecurityGroup #

Generic CreateSecurityGroup Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

Associated Types

type Rep CreateSecurityGroup :: Type -> Type #

Read CreateSecurityGroup Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

Show CreateSecurityGroup Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

NFData CreateSecurityGroup Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

Methods

rnf :: CreateSecurityGroup -> () #

Eq CreateSecurityGroup Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

Hashable CreateSecurityGroup Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

type AWSResponse CreateSecurityGroup Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

type Rep CreateSecurityGroup Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

type Rep CreateSecurityGroup = D1 ('MetaData "CreateSecurityGroup" "Amazonka.EC2.CreateSecurityGroup" "amazonka-ec2-2.0-48L9RAJvmvzAdBkRegqWCL" 'False) (C1 ('MetaCons "CreateSecurityGroup'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "dryRun") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)) :*: S1 ('MetaSel ('Just "tagSpecifications") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [TagSpecification]))) :*: (S1 ('MetaSel ('Just "vpcId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "description") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "groupName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))))

newCreateSecurityGroup Source #

Create a value of CreateSecurityGroup with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:dryRun:CreateSecurityGroup', createSecurityGroup_dryRun - 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.

CreateSecurityGroup, createSecurityGroup_tagSpecifications - The tags to assign to the security group.

CreateSecurityGroup, createSecurityGroup_vpcId - [EC2-VPC] The ID of the VPC. Required for EC2-VPC.

CreateSecurityGroup, createSecurityGroup_description - A description for the security group. This is informational only.

Constraints: Up to 255 characters in length

Constraints for EC2-Classic: ASCII characters

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

CreateSecurityGroup, createSecurityGroup_groupName - The name of the security group.

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

Constraints for EC2-Classic: ASCII characters

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

Request Lenses

createSecurityGroup_dryRun :: Lens' CreateSecurityGroup (Maybe Bool) Source #

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.

createSecurityGroup_vpcId :: Lens' CreateSecurityGroup (Maybe Text) Source #

EC2-VPC
The ID of the VPC. Required for EC2-VPC.

createSecurityGroup_description :: Lens' CreateSecurityGroup Text Source #

A description for the security group. This is informational only.

Constraints: Up to 255 characters in length

Constraints for EC2-Classic: ASCII characters

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

createSecurityGroup_groupName :: Lens' CreateSecurityGroup Text Source #

The name of the security group.

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

Constraints for EC2-Classic: ASCII characters

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

Destructuring the Response

data CreateSecurityGroupResponse Source #

See: newCreateSecurityGroupResponse smart constructor.

Constructors

CreateSecurityGroupResponse' 

Fields

Instances

Instances details
Generic CreateSecurityGroupResponse Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

Associated Types

type Rep CreateSecurityGroupResponse :: Type -> Type #

Read CreateSecurityGroupResponse Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

Show CreateSecurityGroupResponse Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

NFData CreateSecurityGroupResponse Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

Eq CreateSecurityGroupResponse Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

type Rep CreateSecurityGroupResponse Source # 
Instance details

Defined in Amazonka.EC2.CreateSecurityGroup

type Rep CreateSecurityGroupResponse = D1 ('MetaData "CreateSecurityGroupResponse" "Amazonka.EC2.CreateSecurityGroup" "amazonka-ec2-2.0-48L9RAJvmvzAdBkRegqWCL" 'False) (C1 ('MetaCons "CreateSecurityGroupResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "tags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Tag])) :*: (S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "groupId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))))

newCreateSecurityGroupResponse Source #

Create a value of CreateSecurityGroupResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

CreateSecurityGroupResponse, createSecurityGroupResponse_tags - The tags assigned to the security group.

$sel:httpStatus:CreateSecurityGroupResponse', createSecurityGroupResponse_httpStatus - The response's http status code.

CreateSecurityGroupResponse, createSecurityGroupResponse_groupId - The ID of the security group.

Response Lenses

createSecurityGroupResponse_tags :: Lens' CreateSecurityGroupResponse (Maybe [Tag]) Source #

The tags assigned to the security group.