AWS::EC2::SubnetNetworkAclAssociation
Associates a subnet with a network ACL. For more information, see ReplaceNetworkAclAssociation in the Amazon EC2 API Reference.
When AWS::EC2::SubnetNetworkAclAssociation
resources are created during create or update operations, AWS CloudFormation adopts
existing resources that share the same key
properties (the properties that contribute to uniquely identify the resource).
However, if the operation fails and rolls back, AWS CloudFormation deletes the previously
out-of-band resources.
You can protect against this behavior by using Retain deletion policies. For more information, see
DeletionPolicy Attribute.
Note
The EC2 API Reference refers to the SubnetId parameter as the
AssociationId.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::EC2::SubnetNetworkAclAssociation", "Properties" : { "SubnetId" :String, "NetworkAclId" :String} }
YAML
Type: AWS::EC2::SubnetNetworkAclAssociation Properties: SubnetId:StringNetworkAclId:String
Properties
SubnetId-
The ID representing the current association between the original network ACL and the subnet.
Required: Yes
Type: String
Update requires: Replacement
NetworkAclId-
The ID of the new ACL to associate with the subnet.
Required: Yes
Type: String
Update requires: Replacement
Return Values
Ref
When the logical ID of this resource is provided to the Ref intrinsic
function, Ref returns the resource name.
For more information about using the Ref function, see Ref.
Fn::GetAtt
Fn::GetAtt returns a value for a specified attribute of this type.
The following are the available attributes and sample return values.
AssociationId-
Returns the value of this object's SubnetId property.
For more information about using Fn::GetAtt, see Fn::GetAtt.
Template Examples
JSON
{ "AWSTemplateFormatVersion" : "2010-09-09", "Resources" : { "mySubnetNetworkAclAssociation" : { "Type" : "AWS::EC2::SubnetNetworkAclAssociation", "Properties" : { "SubnetId" : { "Ref" : "mySubnet" }, "NetworkAclId" : { "Ref" : "myNetworkAcl" } } } } }
YAML
AWSTemplateFormatVersion: '2010-09-09' Resources: mySubnetNetworkAclAssociation: Type: AWS::EC2::SubnetNetworkAclAssociation Properties: SubnetId: Ref: mySubnet NetworkAclId: Ref: myNetworkAcl
