Skip to content
v2.274.0

CfnSecurityGroupProps Struct ​

Properties for defining a CfnSecurityGroup.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const cfnSecurityGroupProps: ec2.CfnSecurityGroupProps = {
  groupDescription: 'groupDescription',

  // the properties below are optional
  groupName: 'groupName',
  securityGroupEgress: [{
    ipProtocol: 'ipProtocol',

    // the properties below are optional
    cidrIp: 'cidrIp',
    cidrIpv6: 'cidrIpv6',
    description: 'description',
    destinationPrefixListId: 'destinationPrefixListId',
    destinationSecurityGroupId: 'destinationSecurityGroupId',
    fromPort: 123,
    toPort: 123,
  }],
  securityGroupIngress: [{
    ipProtocol: 'ipProtocol',

    // the properties below are optional
    cidrIp: 'cidrIp',
    cidrIpv6: 'cidrIpv6',
    description: 'description',
    fromPort: 123,
    sourcePrefixListId: 'sourcePrefixListId',
    sourceSecurityGroupId: 'sourceSecurityGroupId',
    sourceSecurityGroupName: 'sourceSecurityGroupName',
    sourceSecurityGroupOwnerId: 'sourceSecurityGroupOwnerId',
    toPort: 123,
  }],
  tags: [{
    key: 'key',
    value: 'value',
  }],
  vpcId: 'vpcId',
};

Properties ​

groupDescriptionstringgroup_descriptionstrgroupDescriptionStringGroupDescriptionstringGroupDescription*stringrequired#
A description for the security group.

Constraints: Up to 255 characters in length

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

groupNamestringgroup_namestrgroupNameStringGroupNamestringGroupName*string#
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 ._-😕()#,@[]+=&;{}!$*

securityGroupEgressIResolvable | IResolvable | CfnSecurityGroup.EgressProperty[]security_group_egresstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, EgressProperty]]]securityGroupEgressIResolvableSecurityGroupEgressIResolvableSecurityGroupEgressinterface{}#
The outbound rules associated with the security group.
securityGroupIngressIResolvable | IResolvable | CfnSecurityGroup.IngressProperty[]security_group_ingresstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, IngressProperty]]]securityGroupIngressIResolvableSecurityGroupIngressIResolvableSecurityGroupIngressinterface{}#
The inbound rules associated with the security group.
tagsCfnTag[]tagstyping.List[CfnTag]tagsList<CfnTag>TagsCfnTag[]Tags*[]CfnTag#
Any tags assigned to the security group.
vpcIdstring | IVPCRefvpc_idtyping.Union[str, IVPCRef]vpcIdStringVpcIdstringVpcIdinterface{}#
The ID of the VPC for the security group.

If you do not specify a VPC, the default is to use the default VPC for the Region. If there's no specified VPC and no default VPC, security group creation fails.