interface CfnSecurityGroupProps
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.EC2.CfnSecurityGroupProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#CfnSecurityGroupProps |
Java | software.amazon.awscdk.services.ec2.CfnSecurityGroupProps |
Python | aws_cdk.aws_ec2.CfnSecurityGroupProps |
TypeScript | aws-cdk-lib » aws_ec2 » CfnSecurityGroupProps |
Properties for defining a CfnSecurityGroup.
See also: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-securitygroup.html
Example
// 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
| Name | Type | Description |
|---|---|---|
| group | string | A description for the security group. |
| group | string | The name of the security group. Names are case-insensitive and must be unique within the VPC. |
| security | IResolvable | (IResolvable | Egress)[] | The outbound rules associated with the security group. |
| security | IResolvable | (IResolvable | Ingress)[] | The inbound rules associated with the security group. |
| tags? | Cfn[] | Any tags assigned to the security group. |
| vpc | string | The ID of the VPC for the security group. |
groupDescription
Type:
string
A description for the security group.
Constraints: Up to 255 characters in length
Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
groupName?
Type:
string
(optional)
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 ._-:/()#,@[]+=&;{}!$*
securityGroupEgress?
Type:
IResolvable | (IResolvable | Egress)[]
(optional)
The outbound rules associated with the security group.
securityGroupIngress?
Type:
IResolvable | (IResolvable | Ingress)[]
(optional)
The inbound rules associated with the security group.
tags?
Type:
Cfn[]
(optional)
Any tags assigned to the security group.
vpcId?
Type:
string
(optional)
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.

.NET
Go
Java
Python
TypeScript