Class CfnSecurityGroupPropsMixin
- All Implemented Interfaces:
IMixin,software.amazon.jsii.JsiiSerializable
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.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.mixins.preview.mixins.*;
import software.amazon.awscdk.mixins.preview.services.ec2.mixins.*;
CfnSecurityGroupPropsMixin cfnSecurityGroupPropsMixin = CfnSecurityGroupPropsMixin.Builder.create(CfnSecurityGroupMixinProps.builder()
.groupDescription("groupDescription")
.groupName("groupName")
.securityGroupEgress(List.of(EgressProperty.builder()
.cidrIp("cidrIp")
.cidrIpv6("cidrIpv6")
.description("description")
.destinationPrefixListId("destinationPrefixListId")
.destinationSecurityGroupId("destinationSecurityGroupId")
.fromPort(123)
.ipProtocol("ipProtocol")
.toPort(123)
.build()))
.securityGroupIngress(List.of(IngressProperty.builder()
.cidrIp("cidrIp")
.cidrIpv6("cidrIpv6")
.description("description")
.fromPort(123)
.ipProtocol("ipProtocol")
.sourcePrefixListId("sourcePrefixListId")
.sourceSecurityGroupId("sourceSecurityGroupId")
.sourceSecurityGroupName("sourceSecurityGroupName")
.sourceSecurityGroupOwnerId("sourceSecurityGroupOwnerId")
.toPort(123)
.build()))
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.vpcId("vpcId")
.build())
.strategy(PropertyMergeStrategy.OVERRIDE)
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnSecurityGroupPropsMixin.static interfaceAdds the specified outbound (egress) rule to a security group.static interfaceAdds an inbound (ingress) rule to a security group.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.mixins.preview.core.IMixin
IMixin.Jsii$Default, IMixin.Jsii$Proxy -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate a mixin to apply properties toAWS::EC2::SecurityGroup.Create a mixin to apply properties toAWS::EC2::SecurityGroup.protectedCfnSecurityGroupPropsMixin(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnSecurityGroupPropsMixin(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionsoftware.constructs.IConstructapplyTo(software.constructs.IConstruct construct) Apply the mixin properties to the construct.protected CfnSecurityGroupMixinPropsgetProps()protected PropertyMergeStrategysupports(software.constructs.IConstruct construct) Check if this mixin supports the given construct.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_PROPERTY_KEYS
-
-
Constructor Details
-
CfnSecurityGroupPropsMixin
protected CfnSecurityGroupPropsMixin(software.amazon.jsii.JsiiObjectRef objRef) -
CfnSecurityGroupPropsMixin
protected CfnSecurityGroupPropsMixin(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnSecurityGroupPropsMixin
@Stability(Stable) public CfnSecurityGroupPropsMixin(@NotNull CfnSecurityGroupMixinProps props, @Nullable CfnPropertyMixinOptions options) Create a mixin to apply properties toAWS::EC2::SecurityGroup.- Parameters:
props- L1 properties to apply. This parameter is required.options- Mixin options.
-
CfnSecurityGroupPropsMixin
Create a mixin to apply properties toAWS::EC2::SecurityGroup.- Parameters:
props- L1 properties to apply. This parameter is required.
-
-
Method Details
-
applyTo
@Stability(Stable) @NotNull public software.constructs.IConstruct applyTo(@NotNull software.constructs.IConstruct construct) Apply the mixin properties to the construct. -
supports
@Stability(Stable) @NotNull public Boolean supports(@NotNull software.constructs.IConstruct construct) Check if this mixin supports the given construct. -
getProps
-
getStrategy
-