class CfnSecurityGroupPropsMixin
| Language | Type name |
|---|---|
.NET | Amazon.CDK.Mixins.Preview.AWS.EC2.Mixins.CfnSecurityGroupPropsMixin |
Go | github.com/aws/aws-cdk-go/awscdkmixinspreview/v2/awsec2/mixins#CfnSecurityGroupPropsMixin |
Java | software.amazon.awscdk.mixins.preview.services.ec2.mixins.CfnSecurityGroupPropsMixin |
Python | aws_cdk.mixins_preview.aws_ec2.mixins.CfnSecurityGroupPropsMixin |
TypeScript | @aws-cdk/mixins-preview » aws_ec2 » mixins » CfnSecurityGroupPropsMixin |
Implements
IMixin
Extends
Mixin
Specifies a security group.
You must specify ingress rules to allow inbound traffic. By default, no inbound traffic is allowed.
When you create a security group, if you do not add egress rules, we add egress rules that allow all outbound IPv4 and IPv6 traffic. Otherwise, we do not add them. After the security group is created, if you remove all egress rules that you added, we do not add egress rules, so no outbound traffic is allowed.
If you modify a rule, CloudFormation removes the existing rule and then adds a new rule. There is a brief period when neither the original rule or the new rule exists, so the corresponding traffic is dropped.
This type supports updates. For more information about updating stacks, see AWS CloudFormation Stacks Updates .
To cross-reference two security groups in the ingress and egress rules of those security groups, use the AWS::EC2::SecurityGroupEgress and AWS::EC2::SecurityGroupIngress resources to define your rules. Do not use the embedded ingress and egress rules in the
AWS::EC2::SecurityGroup. Doing so creates a circular dependency, which CloudFormation doesn't allow.
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 { mixins } from '@aws-cdk/mixins-preview';
import { mixins as ec2_mixins } from '@aws-cdk/mixins-preview/aws-ec2';
const cfnSecurityGroupPropsMixin = new ec2_mixins.CfnSecurityGroupPropsMixin({
groupDescription: 'groupDescription',
groupName: 'groupName',
securityGroupEgress: [{
cidrIp: 'cidrIp',
cidrIpv6: 'cidrIpv6',
description: 'description',
destinationPrefixListId: 'destinationPrefixListId',
destinationSecurityGroupId: 'destinationSecurityGroupId',
fromPort: 123,
ipProtocol: 'ipProtocol',
toPort: 123,
}],
securityGroupIngress: [{
cidrIp: 'cidrIp',
cidrIpv6: 'cidrIpv6',
description: 'description',
fromPort: 123,
ipProtocol: 'ipProtocol',
sourcePrefixListId: 'sourcePrefixListId',
sourceSecurityGroupId: 'sourceSecurityGroupId',
sourceSecurityGroupName: 'sourceSecurityGroupName',
sourceSecurityGroupOwnerId: 'sourceSecurityGroupOwnerId',
toPort: 123,
}],
tags: [{
key: 'key',
value: 'value',
}],
vpcId: 'vpcId',
}, /* all optional props */ {
strategy: mixins.PropertyMergeStrategy.OVERRIDE,
});
Initializer
new CfnSecurityGroupPropsMixin(props: CfnSecurityGroupMixinProps, options?: CfnPropertyMixinOptions)
Parameters
- props
Cfn— L1 properties to apply.Security Group Mixin Props - options
Cfn— Mixin options.Property Mixin Options
Create a mixin to apply properties to AWS::EC2::SecurityGroup.
Properties
| Name | Type | Description |
|---|---|---|
| props | Cfn | |
| strategy | Property | |
| static CFN_PROPERTY_KEYS | string[] |
props
Type:
Cfn
strategy
Type:
Property
static CFN_PROPERTY_KEYS
Type:
string[]
Methods
| Name | Description |
|---|---|
| apply | Apply the mixin properties to the construct. |
| supports(construct) | Check if this mixin supports the given construct. |
applyTo(construct)
public applyTo(construct: IConstruct): IConstruct
Parameters
- construct
IConstruct
Returns
Apply the mixin properties to the construct.
supports(construct)
public supports(construct: IConstruct): boolean
Parameters
- construct
IConstruct
Returns
boolean
Check if this mixin supports the given construct.

.NET
Go
Java
Python
TypeScript