CfnPolicy L1 construct
An AWS Firewall Manager policy.
A Firewall Manager policy is specific to the individual policy type. If you want to enforce multiple policy types across accounts, you can create multiple policies. You can create more than one policy for each type.
If you add a new account to an organization that you created with AWS Organizations , Firewall Manager automatically applies the policy to the resources in that account that are within scope of the policy.
Policies require some setup to use. For more information, see the sections on prerequisites and getting started under Firewall Manager prerequisites .
Firewall Manager provides the following types of policies:
AWS WAF policy - This policy applies AWS WAF web ACL protections to specified accounts and resources.
Shield Advanced policy - This policy applies Shield Advanced protection to specified accounts and resources.
Security Groups policy - This type of policy gives you control over security groups that are in use throughout your organization in AWS Organizations and lets you enforce a baseline set of rules across your organization.
Network ACL policy - This type of policy gives you control over the network ACLs that are in use throughout your organization in AWS Organizations and lets you enforce a baseline set of first and last network ACL rules across your organization.
Network Firewall policy - This policy applies Network Firewall protection to your organization's VPCs.
DNS Firewall policy - This policy applies Amazon Route 53 Resolver DNS Firewall protections to your organization's VPCs.
Third-party firewall policy - This policy applies third-party firewall protections. Third-party firewalls are available by subscription through the AWS Marketplace console at AWS Marketplace .
Palo Alto Networks Cloud NGFW policy - This policy applies Palo Alto Networks Cloud Next Generation Firewall (NGFW) protections and Palo Alto Networks Cloud NGFW rulestacks to your organization's VPCs.
Fortigate CNF policy - This policy applies Fortigate Cloud Native Firewall (CNF) protections. Fortigate CNF is a cloud-centered solution that blocks Zero-Day threats and secures cloud infrastructures with industry-leading advanced threat prevention, smart web application firewalls (WAF), and API protection.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_fms as fms } from 'aws-cdk-lib';
const cfnPolicy = new fms.CfnPolicy(this, 'MyCfnPolicy', {
excludeResourceTags: false,
policyName: 'policyName',
remediationEnabled: false,
securityServicePolicyData: {
type: 'type',
// the properties below are optional
managedServiceData: 'managedServiceData',
policyOption: {
networkAclCommonPolicy: {
networkAclEntrySet: {
forceRemediateForFirstEntries: false,
forceRemediateForLastEntries: false,
// the properties below are optional
firstEntries: [{
egress: false,
protocol: 'protocol',
ruleAction: 'ruleAction',
// the properties below are optional
cidrBlock: 'cidrBlock',
icmpTypeCode: {
code: 123,
type: 123,
},
ipv6CidrBlock: 'ipv6CidrBlock',
portRange: {
from: 123,
to: 123,
},
}],
lastEntries: [{
egress: false,
protocol: 'protocol',
ruleAction: 'ruleAction',
// the properties below are optional
cidrBlock: 'cidrBlock',
icmpTypeCode: {
code: 123,
type: 123,
},
ipv6CidrBlock: 'ipv6CidrBlock',
portRange: {
from: 123,
to: 123,
},
}],
},
},
networkFirewallPolicy: {
firewallDeploymentModel: 'firewallDeploymentModel',
},
thirdPartyFirewallPolicy: {
firewallDeploymentModel: 'firewallDeploymentModel',
},
},
},
// the properties below are optional
deleteAllPolicyResources: false,
excludeMap: {
account: ['account'],
orgunit: ['orgunit'],
},
includeMap: {
account: ['account'],
orgunit: ['orgunit'],
},
policyDescription: 'policyDescription',
resourcesCleanUp: false,
resourceSetIds: ['resourceSetIds'],
resourceTagLogicalOperator: 'resourceTagLogicalOperator',
resourceTags: [{
key: 'key',
// the properties below are optional
value: 'value',
}],
resourceType: 'resourceType',
resourceTypeList: ['resourceTypeList'],
tags: [{
key: 'key',
value: 'value',
}],
});
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_fms as fms
cfn_policy = fms.CfnPolicy(self, "MyCfnPolicy",
exclude_resource_tags=False,
policy_name="policyName",
remediation_enabled=False,
security_service_policy_data=fms.CfnPolicy.SecurityServicePolicyDataProperty(
type="type",
# the properties below are optional
managed_service_data="managedServiceData",
policy_option=fms.CfnPolicy.PolicyOptionProperty(
network_acl_common_policy=fms.CfnPolicy.NetworkAclCommonPolicyProperty(
network_acl_entry_set=fms.CfnPolicy.NetworkAclEntrySetProperty(
force_remediate_for_first_entries=False,
force_remediate_for_last_entries=False,
# the properties below are optional
first_entries=[fms.CfnPolicy.NetworkAclEntryProperty(
egress=False,
protocol="protocol",
rule_action="ruleAction",
# the properties below are optional
cidr_block="cidrBlock",
icmp_type_code=fms.CfnPolicy.IcmpTypeCodeProperty(
code=123,
type=123
),
ipv6_cidr_block="ipv6CidrBlock",
port_range=fms.CfnPolicy.PortRangeProperty(
from=123,
to=123
)
)],
last_entries=[fms.CfnPolicy.NetworkAclEntryProperty(
egress=False,
protocol="protocol",
rule_action="ruleAction",
# the properties below are optional
cidr_block="cidrBlock",
icmp_type_code=fms.CfnPolicy.IcmpTypeCodeProperty(
code=123,
type=123
),
ipv6_cidr_block="ipv6CidrBlock",
port_range=fms.CfnPolicy.PortRangeProperty(
from=123,
to=123
)
)]
)
),
network_firewall_policy=fms.CfnPolicy.NetworkFirewallPolicyProperty(
firewall_deployment_model="firewallDeploymentModel"
),
third_party_firewall_policy=fms.CfnPolicy.ThirdPartyFirewallPolicyProperty(
firewall_deployment_model="firewallDeploymentModel"
)
)
),
# the properties below are optional
delete_all_policy_resources=False,
exclude_map={
"account": ["account"],
"orgunit": ["orgunit"]
},
include_map={
"account": ["account"],
"orgunit": ["orgunit"]
},
policy_description="policyDescription",
resources_clean_up=False,
resource_set_ids=["resourceSetIds"],
resource_tag_logical_operator="resourceTagLogicalOperator",
resource_tags=[fms.CfnPolicy.ResourceTagProperty(
key="key",
# the properties below are optional
value="value"
)],
resource_type="resourceType",
resource_type_list=["resourceTypeList"],
tags=[fms.CfnPolicy.PolicyTagProperty(
key="key",
value="value"
)]
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.fms.*;
CfnPolicy cfnPolicy = CfnPolicy.Builder.create(this, "MyCfnPolicy")
.excludeResourceTags(false)
.policyName("policyName")
.remediationEnabled(false)
.securityServicePolicyData(SecurityServicePolicyDataProperty.builder()
.type("type")
// the properties below are optional
.managedServiceData("managedServiceData")
.policyOption(PolicyOptionProperty.builder()
.networkAclCommonPolicy(NetworkAclCommonPolicyProperty.builder()
.networkAclEntrySet(NetworkAclEntrySetProperty.builder()
.forceRemediateForFirstEntries(false)
.forceRemediateForLastEntries(false)
// the properties below are optional
.firstEntries(List.of(NetworkAclEntryProperty.builder()
.egress(false)
.protocol("protocol")
.ruleAction("ruleAction")
// the properties below are optional
.cidrBlock("cidrBlock")
.icmpTypeCode(IcmpTypeCodeProperty.builder()
.code(123)
.type(123)
.build())
.ipv6CidrBlock("ipv6CidrBlock")
.portRange(PortRangeProperty.builder()
.from(123)
.to(123)
.build())
.build()))
.lastEntries(List.of(NetworkAclEntryProperty.builder()
.egress(false)
.protocol("protocol")
.ruleAction("ruleAction")
// the properties below are optional
.cidrBlock("cidrBlock")
.icmpTypeCode(IcmpTypeCodeProperty.builder()
.code(123)
.type(123)
.build())
.ipv6CidrBlock("ipv6CidrBlock")
.portRange(PortRangeProperty.builder()
.from(123)
.to(123)
.build())
.build()))
.build())
.build())
.networkFirewallPolicy(NetworkFirewallPolicyProperty.builder()
.firewallDeploymentModel("firewallDeploymentModel")
.build())
.thirdPartyFirewallPolicy(ThirdPartyFirewallPolicyProperty.builder()
.firewallDeploymentModel("firewallDeploymentModel")
.build())
.build())
.build())
// the properties below are optional
.deleteAllPolicyResources(false)
.excludeMap(Map.of(
"account", List.of("account"),
"orgunit", List.of("orgunit")))
.includeMap(Map.of(
"account", List.of("account"),
"orgunit", List.of("orgunit")))
.policyDescription("policyDescription")
.resourcesCleanUp(false)
.resourceSetIds(List.of("resourceSetIds"))
.resourceTagLogicalOperator("resourceTagLogicalOperator")
.resourceTags(List.of(ResourceTagProperty.builder()
.key("key")
// the properties below are optional
.value("value")
.build()))
.resourceType("resourceType")
.resourceTypeList(List.of("resourceTypeList"))
.tags(List.of(PolicyTagProperty.builder()
.key("key")
.value("value")
.build()))
.build();
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.FMS;
var cfnPolicy = new CfnPolicy(this, "MyCfnPolicy", new CfnPolicyProps {
ExcludeResourceTags = false,
PolicyName = "policyName",
RemediationEnabled = false,
SecurityServicePolicyData = new SecurityServicePolicyDataProperty {
Type = "type",
// the properties below are optional
ManagedServiceData = "managedServiceData",
PolicyOption = new PolicyOptionProperty {
NetworkAclCommonPolicy = new NetworkAclCommonPolicyProperty {
NetworkAclEntrySet = new NetworkAclEntrySetProperty {
ForceRemediateForFirstEntries = false,
ForceRemediateForLastEntries = false,
// the properties below are optional
FirstEntries = new [] { new NetworkAclEntryProperty {
Egress = false,
Protocol = "protocol",
RuleAction = "ruleAction",
// the properties below are optional
CidrBlock = "cidrBlock",
IcmpTypeCode = new IcmpTypeCodeProperty {
Code = 123,
Type = 123
},
Ipv6CidrBlock = "ipv6CidrBlock",
PortRange = new PortRangeProperty {
From = 123,
To = 123
}
} },
LastEntries = new [] { new NetworkAclEntryProperty {
Egress = false,
Protocol = "protocol",
RuleAction = "ruleAction",
// the properties below are optional
CidrBlock = "cidrBlock",
IcmpTypeCode = new IcmpTypeCodeProperty {
Code = 123,
Type = 123
},
Ipv6CidrBlock = "ipv6CidrBlock",
PortRange = new PortRangeProperty {
From = 123,
To = 123
}
} }
}
},
NetworkFirewallPolicy = new NetworkFirewallPolicyProperty {
FirewallDeploymentModel = "firewallDeploymentModel"
},
ThirdPartyFirewallPolicy = new ThirdPartyFirewallPolicyProperty {
FirewallDeploymentModel = "firewallDeploymentModel"
}
}
},
// the properties below are optional
DeleteAllPolicyResources = false,
ExcludeMap = new Dictionary<string, string[]?> {
{ "account", new [] { "account" } },
{ "orgunit", new [] { "orgunit" } }
},
IncludeMap = new Dictionary<string, string[]?> {
{ "account", new [] { "account" } },
{ "orgunit", new [] { "orgunit" } }
},
PolicyDescription = "policyDescription",
ResourcesCleanUp = false,
ResourceSetIds = new [] { "resourceSetIds" },
ResourceTagLogicalOperator = "resourceTagLogicalOperator",
ResourceTags = new [] { new ResourceTagProperty {
Key = "key",
// the properties below are optional
Value = "value"
} },
ResourceType = "resourceType",
ResourceTypeList = new [] { "resourceTypeList" },
Tags = new [] { new PolicyTagProperty {
Key = "key",
Value = "value"
} }
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
cfnPolicy := awscdk.Aws_fms.NewCfnPolicy(this, jsii.String("MyCfnPolicy"), &CfnPolicyProps{
ExcludeResourceTags: jsii.Boolean(false),
PolicyName: jsii.String("policyName"),
RemediationEnabled: jsii.Boolean(false),
SecurityServicePolicyData: &SecurityServicePolicyDataProperty{
Type: jsii.String("type"),
// the properties below are optional
ManagedServiceData: jsii.String("managedServiceData"),
PolicyOption: &PolicyOptionProperty{
NetworkAclCommonPolicy: &NetworkAclCommonPolicyProperty{
NetworkAclEntrySet: &NetworkAclEntrySetProperty{
ForceRemediateForFirstEntries: jsii.Boolean(false),
ForceRemediateForLastEntries: jsii.Boolean(false),
// the properties below are optional
FirstEntries: []interface{}{
&NetworkAclEntryProperty{
Egress: jsii.Boolean(false),
Protocol: jsii.String("protocol"),
RuleAction: jsii.String("ruleAction"),
// the properties below are optional
CidrBlock: jsii.String("cidrBlock"),
IcmpTypeCode: &IcmpTypeCodeProperty{
Code: jsii.Number(123),
Type: jsii.Number(123),
},
Ipv6CidrBlock: jsii.String("ipv6CidrBlock"),
PortRange: &PortRangeProperty{
From: jsii.Number(123),
To: jsii.Number(123),
},
},
},
LastEntries: []interface{}{
&NetworkAclEntryProperty{
Egress: jsii.Boolean(false),
Protocol: jsii.String("protocol"),
RuleAction: jsii.String("ruleAction"),
// the properties below are optional
CidrBlock: jsii.String("cidrBlock"),
IcmpTypeCode: &IcmpTypeCodeProperty{
Code: jsii.Number(123),
Type: jsii.Number(123),
},
Ipv6CidrBlock: jsii.String("ipv6CidrBlock"),
PortRange: &PortRangeProperty{
From: jsii.Number(123),
To: jsii.Number(123),
},
},
},
},
},
NetworkFirewallPolicy: &NetworkFirewallPolicyProperty{
FirewallDeploymentModel: jsii.String("firewallDeploymentModel"),
},
ThirdPartyFirewallPolicy: &ThirdPartyFirewallPolicyProperty{
FirewallDeploymentModel: jsii.String("firewallDeploymentModel"),
},
},
},
// the properties below are optional
DeleteAllPolicyResources: jsii.Boolean(false),
ExcludeMap: map[string][]*string{
"account": []*string{
jsii.String("account"),
},
"orgunit": []*string{
jsii.String("orgunit"),
},
},
IncludeMap: map[string][]*string{
"account": []*string{
jsii.String("account"),
},
"orgunit": []*string{
jsii.String("orgunit"),
},
},
PolicyDescription: jsii.String("policyDescription"),
ResourcesCleanUp: jsii.Boolean(false),
ResourceSetIds: []*string{
jsii.String("resourceSetIds"),
},
ResourceTagLogicalOperator: jsii.String("resourceTagLogicalOperator"),
ResourceTags: []interface{}{
&ResourceTagProperty{
Key: jsii.String("key"),
// the properties below are optional
Value: jsii.String("value"),
},
},
ResourceType: jsii.String("resourceType"),
ResourceTypeList: []*string{
jsii.String("resourceTypeList"),
},
Tags: []PolicyTagProperty{
&PolicyTagProperty{
Key: jsii.String("key"),
Value: jsii.String("value"),
},
},
})
Initializer
new CfnPolicy(scope: Construct, id: string, props: CfnPolicyProps)
CfnPolicy(scope: Construct, id: str, props: CfnPolicyProps)
new CfnPolicy(Construct scope, String id, CfnPolicyProps props)
new CfnPolicy(Construct scope, string id, CfnPolicyProps props)
NewCfnPolicy(Scope Construct, Id *string, Props CfnPolicyProps)
Construct Props
deleteAllPolicyResourcesoptionalboolean | IResolvabledelete_all_policy_resourcesoptionaltyping.Union[bool, IResolvable]deleteAllPolicyResourcesoptionalBooleanDeleteAllPolicyResourcesoptionalboolDeleteAllPolicyResourcesoptionalinterface{}#notes
For AWS WAF and Shield Advanced policies, Firewall Manager does the following:
- Deletes rule groups created by Firewall Manager
- Removes web ACLs from in-scope resources
- Deletes web ACLs that contain no rules or rule groups
For security group policies, Firewall Manager does the following for each security group in the policy:
- Disassociates the security group from in-scope resources
- Deletes the security group if it was created through Firewall Manager and if it's no longer associated with any resources through another policy
After the cleanup, in-scope resources are no longer protected by web ACLs in this policy. Protection of out-of-scope resources remains unchanged. Scope is determined by tags that you create and accounts that you associate with the policy. When creating the policy, if you specify that only resources in specific accounts or with specific tags are in scope of the policy, those accounts and resources are handled by the policy. All others are out of scope. If you don't specify tags or accounts, all resources are in scope.
excludeMapoptionalIResolvable | CfnPolicy.IEMapPropertyexclude_mapoptionaltyping.Union[IResolvable, IEMapProperty]excludeMapoptionalIResolvableExcludeMapoptionalIResolvableExcludeMapoptionalinterface{}#notes
Specifying an OU is the equivalent of specifying all accounts in the OU and in any of its child OUs, including any child OUs and accounts that are added at a later time.
You can specify inclusions or exclusions, but not both. If you specify an IncludeMap , AWS Firewall Manager applies the policy to all accounts specified by the IncludeMap , and does not evaluate any ExcludeMap specifications. If you do not specify an IncludeMap , then Firewall Manager applies the policy to all accounts except for those specified by the ExcludeMap .
You can specify account IDs, OUs, or a combination:
- Specify account IDs by setting the key to
ACCOUNT. For example, the following is a valid map:{“ACCOUNT” : [“accountID1”, “accountID2”]}. - Specify OUs by setting the key to
ORGUNIT. For example, the following is a valid map:{“ORGUNIT” : [“ouid111”, “ouid112”]}. - Specify accounts and OUs together in a single map, separated with a comma. For example, the following is a valid map:
{“ACCOUNT” : [“accountID1”, “accountID2”], “ORGUNIT” : [“ouid111”, “ouid112”]}.
excludeResourceTagsboolean | IResolvableexclude_resource_tagstyping.Union[bool, IResolvable]excludeResourceTagsBooleanExcludeResourceTagsboolExcludeResourceTagsinterface{}required#If this property is True , resources with the specified tags are not in scope of the policy. If it's False , only resources with the specified tags are in scope of the policy.
includeMapoptionalIResolvable | CfnPolicy.IEMapPropertyinclude_mapoptionaltyping.Union[IResolvable, IEMapProperty]includeMapoptionalIResolvableIncludeMapoptionalIResolvableIncludeMapoptionalinterface{}#notes
Specifying an OU is the equivalent of specifying all accounts in the OU and in any of its child OUs, including any child OUs and accounts that are added at a later time.
You can specify inclusions or exclusions, but not both. If you specify an IncludeMap , AWS Firewall Manager applies the policy to all accounts specified by the IncludeMap , and does not evaluate any ExcludeMap specifications. If you do not specify an IncludeMap , then Firewall Manager applies the policy to all accounts except for those specified by the ExcludeMap .
You can specify account IDs, OUs, or a combination:
- Specify account IDs by setting the key to
ACCOUNT. For example, the following is a valid map:{“ACCOUNT” : [“accountID1”, “accountID2”]}. - Specify OUs by setting the key to
ORGUNIT. For example, the following is a valid map:{“ORGUNIT” : [“ouid111”, “ouid112”]}. - Specify accounts and OUs together in a single map, separated with a comma. For example, the following is a valid map:
{“ACCOUNT” : [“accountID1”, “accountID2”], “ORGUNIT” : [“ouid111”, “ouid112”]}.
policyDescriptionoptionalstringpolicy_descriptionoptionalstrpolicyDescriptionoptionalStringPolicyDescriptionoptionalstringPolicyDescriptionoptional*string#remediationEnabledboolean | IResolvableremediation_enabledtyping.Union[bool, IResolvable]remediationEnabledBooleanRemediationEnabledboolRemediationEnabledinterface{}required#resourcesCleanUpoptionalboolean | IResolvableresources_clean_upoptionaltyping.Union[bool, IResolvable]resourcesCleanUpoptionalBooleanResourcesCleanUpoptionalboolResourcesCleanUpoptionalinterface{}#notes
For example, Firewall Manager will disassociate a Firewall Manager managed web ACL from a protected customer resource when the customer resource leaves policy scope.
By default, Firewall Manager doesn't remove protections or delete Firewall Manager managed resources.
This option is not available for Shield Advanced or AWS WAF Classic policies.
resourceSetIdsoptionalstring[]resource_set_idsoptionaltyping.List[str]resourceSetIdsoptionalList<String>ResourceSetIdsoptionalstring[]ResourceSetIdsoptional*[]*string#resourceTagLogicalOperatoroptionalstringresource_tag_logical_operatoroptionalstrresourceTagLogicalOperatoroptionalStringResourceTagLogicalOperatoroptionalstringResourceTagLogicalOperatoroptional*string#Default: AND
resourceTagsoptionalIResolvable | IResolvable | CfnPolicy.ResourceTagProperty[]resource_tagsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, ResourceTagProperty]]]resourceTagsoptionalIResolvableResourceTagsoptionalIResolvableResourceTagsoptionalinterface{}#If this isn't set, then tags aren't used to modify policy scope. See also ExcludeResourceTags .
resourceTypeoptionalstringresource_typeoptionalstrresourceTypeoptionalStringResourceTypeoptionalstringResourceTypeoptional*string#notes
This is in the format shown in the AWS Resource Types Reference . To apply this policy to multiple resource types, specify a resource type of ResourceTypeList and then specify the resource types in a ResourceTypeList .
The following are valid resource types for each Firewall Manager policy type:
- AWS WAF Classic -
AWS::ApiGateway::Stage,AWS::CloudFront::Distribution, andAWS::ElasticLoadBalancingV2::LoadBalancer. - AWS WAF -
AWS::ApiGateway::Stage,AWS::ElasticLoadBalancingV2::LoadBalancer, andAWS::CloudFront::Distribution. - Shield Advanced -
AWS::ElasticLoadBalancingV2::LoadBalancer,AWS::ElasticLoadBalancing::LoadBalancer,AWS::EC2::EIP, andAWS::CloudFront::Distribution. - Network ACL -
AWS::EC2::Subnet. - Security group usage audit -
AWS::EC2::SecurityGroup. - Security group content audit -
AWS::EC2::SecurityGroup,AWS::EC2::NetworkInterface, andAWS::EC2::Instance. - DNS Firewall, AWS Network Firewall , and third-party firewall -
AWS::EC2::VPC.
resourceTypeListoptionalstring[]resource_type_listoptionaltyping.List[str]resourceTypeListoptionalList<String>ResourceTypeListoptionalstring[]ResourceTypeListoptional*[]*string#Use this only to specify multiple resource types. To specify a single resource type, use ResourceType .
securityServicePolicyDataIResolvable | CfnPolicy.SecurityServicePolicyDataPropertysecurity_service_policy_datatyping.Union[IResolvable, SecurityServicePolicyDataProperty]securityServicePolicyDataIResolvableSecurityServicePolicyDataIResolvableSecurityServicePolicyDatainterface{}required#notes
This contains the following settings:
- Type - Indicates the service type that the policy uses to protect the resource. For security group policies, Firewall Manager supports one security group for each common policy and for each content audit policy. This is an adjustable limit that you can increase by contacting .
Valid values: DNS_FIREWALL | NETWORK_FIREWALL | SECURITY_GROUPS_COMMON | SECURITY_GROUPS_CONTENT_AUDIT | SECURITY_GROUPS_USAGE_AUDIT | SHIELD_ADVANCED | THIRD_PARTY_FIREWALL | WAFV2 | WAF
ManagedServiceData - Details about the service that are specific to the service type, in JSON format.
Example:
DNS_FIREWALL
"{\"type\":\"DNS_FIREWALL\",\"preProcessRuleGroups\":[{\"ruleGroupId\":\"rslvr-frg-1\",\"priority\":10}],\"postProcessRuleGroups\":[{\"ruleGroupId\":\"rslvr-frg-2\",\"priority\":9911}]}"
Valid values for
preProcessRuleGroupsare between 1 and 99. Valid values forpostProcessRuleGroupsare between 9901 and 10000.
- Example:
NETWORK_FIREWALL- Centralized deployment model
"{\"type\":\"NETWORK_FIREWALL\",\"awsNetworkFirewallConfig\":{\"networkFirewallStatelessRuleGroupReferences\":[{\"resourceARN\":\"arn:aws:network-firewall:us-east-1:123456789011:stateless-rulegroup/test\",\"priority\":1}],\"networkFirewallStatelessDefaultActions\":[\"aws:forward_to_sfe\",\"customActionName\"],\"networkFirewallStatelessFragmentDefaultActions\":[\"aws:forward_to_sfe\",\"customActionName\"],\"networkFirewallStatelessCustomActions\":[{\"actionName\":\"customActionName\",\"actionDefinition\":{\"publishMetricAction\":{\"dimensions\":[{\"value\":\"metricdimensionvalue\"}]}}}],\"networkFirewallStatefulRuleGroupReferences\":[{\"resourceARN\":\"arn:aws:network-firewall:us-east-1:123456789011:stateful-rulegroup/test\"}],\"networkFirewallLoggingConfiguration\":{\"logDestinationConfigs\":[{\"logDestinationType\":\"S3\",\"logType\":\"ALERT\",\"logDestination\":{\"bucketName\":\"s3-bucket-name\"}},{\"logDestinationType\":\"S3\",\"logType\":\"FLOW\",\"logDestination\":{\"bucketName\":\"s3-bucket-name\"}}],\"overrideExistingConfig\":true}},\"firewallDeploymentModel\":{\"centralizedFirewallDeploymentModel\":{\"centralizedFirewallOrchestrationConfig\":{\"inspectionVpcIds\":[{\"resourceId\":\"vpc-1234\",\"accountId\":\"123456789011\"}],\"firewallCreationConfig\":{\"endpointLocation\":{\"availabilityZoneConfigList\":[{\"availabilityZoneId\":null,\"availabilityZoneName\":\"us-east-1a\",\"allowedIPV4CidrList\":[\"10.0.0.0/28\"]}]}},\"allowedIPV4CidrList\":[]}}}}"
To use the distributed deployment model, you must set FirewallDeploymentModel to DISTRIBUTED .
- Example:
NETWORK_FIREWALL- Distributed deployment model with automatic Availability Zone configuration
"{\"type\":\"NETWORK_FIREWALL\",\"networkFirewallStatelessRuleGroupReferences\":[{\"resourceARN\":\"arn:aws:network-firewall:us-east-1:123456789011:stateless-rulegroup/test\",\"priority\":1}],\"networkFirewallStatelessDefaultActions\":[\"aws:forward_to_sfe\",\"customActionName\"],\"networkFirewallStatelessFragmentDefaultActions\":[\"aws:forward_to_sfe\",\"customActionName\"],\"networkFirewallStatelessCustomActions\":[{\"actionName\":\"customActionName\",\"actionDefinition\":{\"publishMetricAction\":{\"dimensions\":[{\"value\":\"metricdimensionvalue\"}]}}}],\"networkFirewallStatefulRuleGroupReferences\":[{\"resourceARN\":\"arn:aws:network-firewall:us-east-1:123456789011:stateful-rulegroup/test\"}],\"networkFirewallOrchestrationConfig\":{\"singleFirewallEndpointPerVPC\":false,\"allowedIPV4CidrList\":[\"10.0.0.0/28\",\"192.168.0.0/28\"],\"routeManagementAction\":\"OFF\"},\"networkFirewallLoggingConfiguration\":{\"logDestinationConfigs\":[{\"logDestinationType\":\"S3\",\"logType\":\"ALERT\",\"logDestination\":{\"bucketName\":\"s3-bucket-name\"}},{\"logDestinationType\":\"S3\",\"logType\":\"FLOW\",\"logDestination\":{\"bucketName\":\"s3-bucket-name\"}}],\"overrideExistingConfig\":true}}"
With automatic Availbility Zone configuration, Firewall Manager chooses which Availability Zones to create the endpoints in. To use the distributed deployment model, you must set FirewallDeploymentModel to DISTRIBUTED .
- Example:
NETWORK_FIREWALL- Distributed deployment model with automatic Availability Zone configuration and route management
"{\"type\":\"NETWORK_FIREWALL\",\"networkFirewallStatelessRuleGroupReferences\":[{\"resourceARN\":\"arn:aws:network-firewall:us-east-1:123456789011:stateless-rulegroup/test\",\"priority\":1}],\"networkFirewallStatelessDefaultActions\":[\"aws:forward_to_sfe\",\"customActionName\"],\"networkFirewallStatelessFragmentDefaultActions\":[\"aws:forward_to_sfe\",\"customActionName\"],\"networkFirewallStatelessCustomActions\":[{\"actionName\":\"customActionName\",\"actionDefinition\":{\"publishMetricAction\":{\"dimensions\":[{\"value\":\"metricdimensionvalue\"}]}}}],\"networkFirewallStatefulRuleGroupReferences\":[{\"resourceARN\":\"arn:aws:network-firewall:us-east-1:123456789011:stateful-rulegroup/test\"}],\"networkFirewallOrchestrationConfig\":{\"singleFirewallEndpointPerVPC\":false,\"allowedIPV4CidrList\":[\"10.0.0.0/28\",\"192.168.0.0/28\"],\"routeManagementAction\":\"MONITOR\",\"routeManagementTargetTypes\":[\"InternetGateway\"]},\"networkFirewallLoggingConfiguration\":{\"logDestinationConfigs\":[{\"logDestinationType\":\"S3\",\"logType\":\"ALERT\",\"logDestination\":{\"bucketName\":\"s3-bucket-name\"}},{\"logDestinationType\":\"S3\",\"logType\": \"FLOW\",\"logDestination\":{\"bucketName\":\"s3-bucket-name\"}}],\"overrideExistingConfig\":true}}"
To use the distributed deployment model, you must set FirewallDeploymentModel to DISTRIBUTED .
- Example:
NETWORK_FIREWALL- Distributed deployment model with custom Availability Zone configuration
"{\"type\":\"NETWORK_FIREWALL\",\"networkFirewallStatelessRuleGroupReferences\":[{\"resourceARN\":\"arn:aws:network-firewall:us-east-1:123456789011:stateless-rulegroup/test\",\"priority\":1}],\"networkFirewallStatelessDefaultActions\":[\"aws:forward_to_sfe\",\"customActionName\"],\"networkFirewallStatelessFragmentDefaultActions\":[\"aws:forward_to_sfe\",\"fragmentcustomactionname\"],\"networkFirewallStatelessCustomActions\":[{\"actionName\":\"customActionName\", \"actionDefinition\":{\"publishMetricAction\":{\"dimensions\":[{\"value\":\"metricdimensionvalue\"}]}}},{\"actionName\":\"fragmentcustomactionname\",\"actionDefinition\":{\"publishMetricAction\":{\"dimensions\":[{\"value\":\"fragmentmetricdimensionvalue\"}]}}}],\"networkFirewallStatefulRuleGroupReferences\":[{\"resourceARN\":\"arn:aws:network-firewall:us-east-1:123456789011:stateful-rulegroup/test\"}],\"networkFirewallOrchestrationConfig\":{\"firewallCreationConfig\":{ \"endpointLocation\":{\"availabilityZoneConfigList\":[{\"availabilityZoneName\":\"us-east-1a\",\"allowedIPV4CidrList\":[\"10.0.0.0/28\"]},{\"availabilityZoneName\":\"us-east-1b\",\"allowedIPV4CidrList\":[ \"10.0.0.0/28\"]}]} },\"singleFirewallEndpointPerVPC\":false,\"allowedIPV4CidrList\":null,\"routeManagementAction\":\"OFF\",\"networkFirewallLoggingConfiguration\":{\"logDestinationConfigs\":[{\"logDestinationType\":\"S3\",\"logType\":\"ALERT\",\"logDestination\":{\"bucketName\":\"s3-bucket-name\"}},{\"logDestinationType\":\"S3\",\"logType\":\"FLOW\",\"logDestination\":{\"bucketName\":\"s3-bucket-name\"}}],\"overrideExistingConfig\":boolean}}"
With custom Availability Zone configuration, you define which specific Availability Zones to create endpoints in by configuring firewallCreationConfig . To configure the Availability Zones in firewallCreationConfig , specify either the availabilityZoneName or availabilityZoneId parameter, not both parameters.
To use the distributed deployment model, you must set FirewallDeploymentModel to DISTRIBUTED .
- Example:
NETWORK_FIREWALL- Distributed deployment model with custom Availability Zone configuration and route management
"{\"type\":\"NETWORK_FIREWALL\",\"networkFirewallStatelessRuleGroupReferences\":[{\"resourceARN\":\"arn:aws:network-firewall:us-east-1:123456789011:stateless-rulegroup/test\",\"priority\":1}],\"networkFirewallStatelessDefaultActions\":[\"aws:forward_to_sfe\",\"customActionName\"],\"networkFirewallStatelessFragmentDefaultActions\":[\"aws:forward_to_sfe\",\"fragmentcustomactionname\"],\"networkFirewallStatelessCustomActions\":[{\"actionName\":\"customActionName\",\"actionDefinition\":{\"publishMetricAction\":{\"dimensions\":[{\"value\":\"metricdimensionvalue\"}]}}},{\"actionName\":\"fragmentcustomactionname\",\"actionDefinition\":{\"publishMetricAction\":{\"dimensions\":[{\"value\":\"fragmentmetricdimensionvalue\"}]}}}],\"networkFirewallStatefulRuleGroupReferences\":[{\"resourceARN\":\"arn:aws:network-firewall:us-east-1:123456789011:stateful-rulegroup/test\"}],\"networkFirewallOrchestrationConfig\":{\"firewallCreationConfig\":{\"endpointLocation\":{\"availabilityZoneConfigList\":[{\"availabilityZoneName\":\"us-east-1a\",\"allowedIPV4CidrList\":[\"10.0.0.0/28\"]},{\"availabilityZoneName\":\"us-east-1b\",\"allowedIPV4CidrList\":[\"10.0.0.0/28\"]}]}},\"singleFirewallEndpointPerVPC\":false,\"allowedIPV4CidrList\":null,\"routeManagementAction\":\"MONITOR\",\"routeManagementTargetTypes\":[\"InternetGateway\"],\"routeManagementConfig\":{\"allowCrossAZTrafficIfNoEndpoint\":true}},\"networkFirewallLoggingConfiguration\":{\"logDestinationConfigs\":[{\"logDestinationType\":\"S3\",\"logType\":\"ALERT\",\"logDestination\":{\"bucketName\":\"s3-bucket-name\"}},{\"logDestinationType\":\"S3\",\"logType\":\"FLOW\",\"logDestination\":{\"bucketName\":\"s3-bucket-name\"}}],\"overrideExistingConfig\":boolean}}"
To use the distributed deployment model, you must set FirewallDeploymentModel to DISTRIBUTED .
- Example:
THIRD_PARTY_FIREWALL- Palo Alto Networks Cloud Next-Generation Firewall centralized deployment model
"{ \"type\":\"THIRD_PARTY_FIREWALL\", \"thirdPartyFirewall\":\"PALO_ALTO_NETWORKS_CLOUD_NGFW\", \"thirdPartyFirewallConfig\":{ \"thirdPartyFirewallPolicyList\":[\"global-1\"] },\"firewallDeploymentModel\":{\"centralizedFirewallDeploymentModel\":{\"centralizedFirewallOrchestrationConfig\":{\"inspectionVpcIds\":[{\"resourceId\":\"vpc-1234\",\"accountId\":\"123456789011\"}],\"firewallCreationConfig\":{\"endpointLocation\":{\"availabilityZoneConfigList\":[{\"availabilityZoneId\":null,\"availabilityZoneName\":\"us-east-1a\",\"allowedIPV4CidrList\":[\"10.0.0.0/28\"]}]}},\"allowedIPV4CidrList\":[]}}}}"
To use the distributed deployment model, you must set FirewallDeploymentModel to CENTRALIZED .
- Example:
THIRD_PARTY_FIREWALL- Palo Alto Networks Cloud Next-Generation Firewall distributed deployment model
"{\"type\":\"THIRD_PARTY_FIREWALL\",\"thirdPartyFirewall\":\"PALO_ALTO_NETWORKS_CLOUD_NGFW\",\"thirdPartyFirewallConfig\":{\"thirdPartyFirewallPolicyList\":[\"global-1\"] },\"firewallDeploymentModel\":{ \"distributedFirewallDeploymentModel\":{ \"distributedFirewallOrchestrationConfig\":{\"firewallCreationConfig\":{\"endpointLocation\":{ \"availabilityZoneConfigList\":[ {\"availabilityZoneName\":\"${AvailabilityZone}\" } ] } }, \"allowedIPV4CidrList\":[ ] } } } }"
To use the distributed deployment model, you must set FirewallDeploymentModel to DISTRIBUTED .
- Specification for
SHIELD_ADVANCEDfor Amazon CloudFront distributions
"{\"type\":\"SHIELD_ADVANCED\",\"automaticResponseConfiguration\": {\"automaticResponseStatus\":\"ENABLED|IGNORED|DISABLED\", \"automaticResponseAction\":\"BLOCK|COUNT\"}, \"overrideCustomerWebaclClassic\":true|false}"
For example: "{\"type\":\"SHIELD_ADVANCED\",\"automaticResponseConfiguration\": {\"automaticResponseStatus\":\"ENABLED\", \"automaticResponseAction\":\"COUNT\"}}"
The default value for automaticResponseStatus is IGNORED . The value for automaticResponseAction is only required when automaticResponseStatus is set to ENABLED . The default value for overrideCustomerWebaclClassic is false .
For other resource types that you can protect with a Shield Advanced policy, this ManagedServiceData configuration is an empty string.
- Example:
WAFV2
"{\"type\":\"WAFV2\",\"preProcessRuleGroups\":[{\"ruleGroupArn\":null,\"overrideAction\":{\"type\":\"NONE\"},\"managedRuleGroupIdentifier\":{\"version\":null,\"vendorName\":\"AWS\",\"managedRuleGroupName\":\"AWSManagedRulesAmazonIpReputationList\"},\"ruleGroupType\":\"ManagedRuleGroup\",\"excludeRules\":[{\"name\":\"NoUserAgent_HEADER\"}]}],\"postProcessRuleGroups\":[],\"defaultAction\":{\"type\":\"ALLOW\"},\"overrideCustomerWebACLAssociation\":false,\"loggingConfiguration\":{\"logDestinationConfigs\":[\"arn:aws:firehose:us-west-2:12345678912:deliverystream/aws-waf-logs-fms-admin-destination\"],\"redactedFields\":[{\"redactedFieldType\":\"SingleHeader\",\"redactedFieldValue\":\"Cookies\"},{\"redactedFieldType\":\"Method\"}]}}"
In the loggingConfiguration , you can specify one logDestinationConfigs , you can optionally provide up to 20 redactedFields , and the RedactedFieldType must be one of URI , QUERY_STRING , HEADER , or METHOD .
- Example:
AWS WAF Classic
"{\"type\": \"WAF\", \"ruleGroups\": [{\"id\":\"12345678-1bcd-9012-efga-0987654321ab\", \"overrideAction\" : {\"type\": \"COUNT\"}}], \"defaultAction\": {\"type\": \"BLOCK\"}}"
- Example:
WAFV2- AWS Firewall Manager support for AWS WAF managed rule group versioning
"{\"type\":\"WAFV2\",\"preProcessRuleGroups\":[{\"ruleGroupArn\":null,\"overrideAction\":{\"type\":\"NONE\"},\"managedRuleGroupIdentifier\":{\"versionEnabled\":true,\"version\":\"Version_2.0\",\"vendorName\":\"AWS\",\"managedRuleGroupName\":\"AWSManagedRulesCommonRuleSet\"},\"ruleGroupType\":\"ManagedRuleGroup\",\"excludeRules\":[{\"name\":\"NoUserAgent_HEADER\"}]}],\"postProcessRuleGroups\":[],\"defaultAction\":{\"type\":\"ALLOW\"},\"overrideCustomerWebACLAssociation\":false,\"loggingConfiguration\":{\"logDestinationConfigs\":[\"arn:aws:firehose:us-west-2:12345678912:deliverystream/aws-waf-logs-fms-admin-destination\"],\"redactedFields\":[{\"redactedFieldType\":\"SingleHeader\",\"redactedFieldValue\":\"Cookies\"},{\"redactedFieldType\":\"Method\"}]}}"
To use a specific version of a AWS WAF managed rule group in your Firewall Manager policy, you must set versionEnabled to true , and set version to the version you'd like to use. If you don't set versionEnabled to true , or if you omit versionEnabled , then Firewall Manager uses the default version of the AWS WAF managed rule group.
- Example:
SECURITY_GROUPS_COMMON
"{\"type\":\"SECURITY_GROUPS_COMMON\",\"revertManualSecurityGroupChanges\":false,\"exclusiveResourceSecurityGroupManagement\":false, \"applyToAllEC2InstanceENIs\":false,\"securityGroups\":[{\"id\":\" sg-000e55995d61a06bd\"}]}"
- Example: Shared VPCs. Apply the preceding policy to resources in shared VPCs as well as to those in VPCs that the account owns
"{\"type\":\"SECURITY_GROUPS_COMMON\",\"revertManualSecurityGroupChanges\":false,\"exclusiveResourceSecurityGroupManagement\":false, \"applyToAllEC2InstanceENIs\":false,\"includeSharedVPC\":true,\"securityGroups\":[{\"id\":\" sg-000e55995d61a06bd\"}]}"
- Example:
SECURITY_GROUPS_CONTENT_AUDIT
"{\"type\":\"SECURITY_GROUPS_CONTENT_AUDIT\",\"securityGroups\":[{\"id\":\"sg-000e55995d61a06bd\"}],\"securityGroupAction\":{\"type\":\"ALLOW\"}}"
The security group action for content audit can be ALLOW or DENY . For ALLOW , all in-scope security group rules must be within the allowed range of the policy's security group rules. For DENY , all in-scope security group rules must not contain a value or a range that matches a rule value or range in the policy security group.
- Example:
SECURITY_GROUPS_USAGE_AUDIT
"{\"type\":\"SECURITY_GROUPS_USAGE_AUDIT\",\"deleteUnusedSecurityGroups\":true,\"coalesceRedundantSecurityGroups\":true}"
tagsoptionalCfnPolicy.PolicyTagProperty[]tagsoptionaltyping.List[PolicyTagProperty]tagsoptionalList<PolicyTagProperty>TagsoptionalPolicyTagProperty[]Tagsoptional*[]PolicyTagProperty#notes
The key:value pair can be anything you define. Typically, the tag key represents a category (such as "environment") and the tag value represents a specific value within that category (such as "test," "development," or "production"). You can add up to 50 tags to each AWS resource.
Properties
cdkTagManagerTagManagercdk_tag_managerTagManagercdkTagManagerTagManagerCdkTagManagerTagManagerCdkTagManagerTagManager#CFN_RESOURCE_TYPE_NAMEstringcfn_resource_type_namestrCFN_RESOURCE_TYPE_NAMEStringCFN_RESOURCE_TYPE_NAMEstringCFN_RESOURCE_TYPE_NAME*stringstatic#cfnOptionsICfnResourceOptionscfn_optionsICfnResourceOptionscfnOptionsICfnResourceOptionsCfnOptionsICfnResourceOptionsCfnOptionsICfnResourceOptions#cfnResourceTypestringcfn_resource_typestrcfnResourceTypeStringCfnResourceTypestringCfnResourceType*string#creationStackstring[]creation_stacktyping.List[str]creationStackList<String>CreationStackstring[]CreationStack*[]*string#deleteAllPolicyResourcesmay be undefinedboolean | IResolvabledelete_all_policy_resourcesmay be undefinedtyping.Union[bool, IResolvable]deleteAllPolicyResourcesmay be undefinedBooleanDeleteAllPolicyResourcesmay be undefinedboolDeleteAllPolicyResourcesmay be undefinedinterface{}#If true , Firewall Manager performs cleanup according to the policy type.
excludeMapmay be undefinedIResolvable | CfnPolicy.IEMapPropertyexclude_mapmay be undefinedtyping.Union[IResolvable, IEMapProperty]excludeMapmay be undefinedIResolvableExcludeMapmay be undefinedIResolvableExcludeMapmay be undefinedinterface{}#excludeResourceTagsboolean | IResolvableexclude_resource_tagstyping.Union[bool, IResolvable]excludeResourceTagsBooleanExcludeResourceTagsboolExcludeResourceTagsinterface{}#includeMapmay be undefinedIResolvable | CfnPolicy.IEMapPropertyinclude_mapmay be undefinedtyping.Union[IResolvable, IEMapProperty]includeMapmay be undefinedIResolvableIncludeMapmay be undefinedIResolvableIncludeMapmay be undefinedinterface{}#The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use overrideLogicalId(newLogicalId).
policyDescriptionmay be undefinedstringpolicy_descriptionmay be undefinedstrpolicyDescriptionmay be undefinedStringPolicyDescriptionmay be undefinedstringPolicyDescriptionmay be undefined*string#policyRefPolicyReferencepolicy_refPolicyReferencepolicyRefPolicyReferencePolicyRefPolicyReferencePolicyRefPolicyReference#If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).
remediationEnabledboolean | IResolvableremediation_enabledtyping.Union[bool, IResolvable]remediationEnabledBooleanRemediationEnabledboolRemediationEnabledinterface{}#resourcesCleanUpmay be undefinedboolean | IResolvableresources_clean_upmay be undefinedtyping.Union[bool, IResolvable]resourcesCleanUpmay be undefinedBooleanResourcesCleanUpmay be undefinedboolResourcesCleanUpmay be undefinedinterface{}#resourceSetIdsmay be undefinedstring[]resource_set_idsmay be undefinedtyping.List[str]resourceSetIdsmay be undefinedList<String>ResourceSetIdsmay be undefinedstring[]ResourceSetIdsmay be undefined*[]*string#resourceTagLogicalOperatormay be undefinedstringresource_tag_logical_operatormay be undefinedstrresourceTagLogicalOperatormay be undefinedStringResourceTagLogicalOperatormay be undefinedstringResourceTagLogicalOperatormay be undefined*string#resourceTagsmay be undefinedIResolvable | IResolvable | CfnPolicy.ResourceTagProperty[]resource_tagsmay be undefinedtyping.Union[IResolvable, typing.List[typing.Union[IResolvable, ResourceTagProperty]]]resourceTagsmay be undefinedIResolvableResourceTagsmay be undefinedIResolvableResourceTagsmay be undefinedinterface{}#resourceTypemay be undefinedstringresource_typemay be undefinedstrresourceTypemay be undefinedStringResourceTypemay be undefinedstringResourceTypemay be undefined*string#resourceTypeListmay be undefinedstring[]resource_type_listmay be undefinedtyping.List[str]resourceTypeListmay be undefinedList<String>ResourceTypeListmay be undefinedstring[]ResourceTypeListmay be undefined*[]*string#securityServicePolicyDataIResolvable | CfnPolicy.SecurityServicePolicyDataPropertysecurity_service_policy_datatyping.Union[IResolvable, SecurityServicePolicyDataProperty]securityServicePolicyDataIResolvableSecurityServicePolicyDataIResolvableSecurityServicePolicyDatainterface{}#CfnElements must be defined within a stack scope (directly or indirectly).
tagsmay be undefinedCfnPolicy.PolicyTagProperty[]tagsmay be undefinedtyping.List[PolicyTagProperty]tagsmay be undefinedList<PolicyTagProperty>Tagsmay be undefinedPolicyTagProperty[]Tagsmay be undefined*[]PolicyTagProperty#Methods
addDeletionOverride(path: string): voiddef add_deletion_override(self, path: str) -> Nonepublic void addDeletionOverride(String path)public void AddDeletionOverride(string path)func AddDeletionOverride(Path *string)#1 parameter
Parameters
pathpathpathpathPath— The path of the value to delete.
addDependency(target: CfnResource): voiddef add_dependency(self, target: CfnResource) -> Nonepublic void addDependency(CfnResource target)public void AddDependency(CfnResource target)func AddDependency(Target CfnResource)deprecated#This method has been renamed to addResourceDependency to more clearly set it apart from construct.node.addDependency. See the documentation of that function for more details.
addDependsOn(target: CfnResource): voiddef add_depends_on(self, target: CfnResource) -> Nonepublic void addDependsOn(CfnResource target)public void AddDependsOn(CfnResource target)func AddDependsOn(Target CfnResource)deprecated#notes
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
This method has been renamed to addResourceDependency, which makes it more clear that this method operates at a different level from the construct-level construct.node.addDependency() mechanism.
addMetadata(key: string, value: any): voiddef add_metadata(self, key: str, value: Any) -> Nonepublic void addMetadata(String key, Object value)public void AddMetadata(string key, object value)func AddMetadata(Key *string, Value interface{})#addOverride(path: string, value: any): voiddef add_override(self, path: str, value: Any) -> Nonepublic void addOverride(String path, Object value)public void AddOverride(string path, object value)func AddOverride(Path *string, Value interface{})#notes · 2 parameters
To add a property override, either use addPropertyOverride or prefix path with "Properties." (i.e. Properties.TopicName).
If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.
For example,
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
would add the overrides
"Properties": {
"GlobalSecondaryIndexes": [
{
"Projection": {
"NonKeyAttributes": [ "myattribute" ]
...
}
...
},
{
"ProjectionType": "INCLUDE"
...
},
]
...
}
The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.
Parameters
pathpathpathpathPath— - The path of the property, you can use dot notation to override values in complex types.valuevaluevaluevalueValue— - The value.
addPropertyDeletionOverride(propertyPath: string): voiddef add_property_deletion_override(self, property_path: str) -> Nonepublic void addPropertyDeletionOverride(String propertyPath)public void AddPropertyDeletionOverride(string propertyPath)func AddPropertyDeletionOverride(PropertyPath *string)#1 parameter
Parameters
propertyPathproperty_pathpropertyPathpropertyPathPropertyPath— The path to the property.
addPropertyOverride(propertyPath: string, value: any): voiddef add_property_override(self, property_path: str, value: Any) -> Nonepublic void addPropertyOverride(String propertyPath, Object value)public void AddPropertyOverride(string propertyPath, object value)func AddPropertyOverride(PropertyPath *string, Value interface{})#Syntactic sugar for addOverride("Properties.<...>", value).
2 parameters
Parameters
propertyPathproperty_pathpropertyPathpropertyPathPropertyPath— The path of the property.valuevaluevaluevalueValue— The value.
addResourceDependency(target: CfnResource, reason?: string): voiddef add_resource_dependency(self, target: CfnResource, reason: typing.Optional[str] = None) -> Nonepublic void addResourceDependency(CfnResource target, String reason)public void AddResourceDependency(CfnResource target, string? reason = null)func AddResourceDependency(Target CfnResource, Reason *string)#notes
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
This method only adds dependencies between L1 resources. If you are looking for a generic construct-to-construct dependency mechanism that works for all constructs including L2s, use construct.node.addDependency instead.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#When set, any cross-stack reference to this resource will use the specified strength instead of the global default from the consuming stack's context.
1 parameter
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): voiddef apply_removal_policy(self, policy: typing.Optional[RemovalPolicy] = None, options: typing.Optional[RemovalPolicyOptions] = None) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy, RemovalPolicyOptions options)public void ApplyRemovalPolicy(RemovalPolicy? policy = null, RemovalPolicyOptions? options = null)func ApplyRemovalPolicy(Policy RemovalPolicy, Options RemovalPolicyOptions)#notes
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:
arnForPolicy(resource: IPolicyRef): string@staticmethod def arn_for_policy(resource: IPolicyRef) -> strpublic static String arnForPolicy(IPolicyRef resource)public static string ArnForPolicy(IPolicyRef resource)func ArnForPolicy(Resource IPolicyRef) *stringstatic#cfnPropertyName(cdkPropertyName: string): stringdef cfn_property_name(self, cdk_property_name: str) -> strpublic String cfnPropertyName(String cdkPropertyName)public string CfnPropertyName(string cdkPropertyName)func CfnPropertyName(CdkPropertyName *string) *string#getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Referencedef get_att(self, attribute_name: str, type_hint: typing.Optional[ResolutionTypeHint] = None) -> Referencepublic Reference getAtt(String attributeName, ResolutionTypeHint typeHint)public Reference GetAtt(string attributeName, ResolutionTypeHint? typeHint = null)func GetAtt(AttributeName *string, TypeHint ResolutionTypeHint) Reference#Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.
1 parameter
Parameters
attributeNameattribute_nameattributeNameattributeNameAttributeName— The name of the attribute.
getMetadata(key: string): anydef get_metadata(self, key: str) -> Anypublic Object getMetadata(String key)public object GetMetadata(string key)func GetMetadata(Key *string) interface{}#inspect(inspector: TreeInspector): voiddef inspect(self, inspector: TreeInspector) -> Nonepublic void inspect(TreeInspector inspector)public void Inspect(TreeInspector inspector)func Inspect(Inspector TreeInspector)#1 parameter
Parameters
inspectorinspectorinspectorinspectorInspector— tree inspector to collect and process attributes.
isCfnElement(x: any): boolean@staticmethod def is_cfn_element(x: Any) -> boolpublic static Boolean isCfnElement(Object x)public static bool IsCfnElement(object x)func IsCfnElement(X interface{}) *boolstatic#Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.
returns
Returns: The construct as a stack element or undefined if it is not a stack element.
isCfnPolicy(x: any): boolean@staticmethod def is_cfn_policy(x: Any) -> boolpublic static Boolean isCfnPolicy(Object x)public static bool IsCfnPolicy(object x)func IsCfnPolicy(X interface{}) *boolstatic#isCfnResource(x: any): boolean@staticmethod def is_cfn_resource(x: Any) -> boolpublic static Boolean isCfnResource(Object x)public static bool IsCfnResource(object x)func IsCfnResource(X interface{}) *boolstatic#isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
obtainDependencies(): Stack | CfnResource[]def obtain_dependencies(self, ) -> typing.List[typing.Union[Stack, CfnResource]]public List<Stack> obtainDependencies()public Stack[] ObtainDependencies()func ObtainDependencies() *[]interface{}#For resources depended on directly, returns the CfnResource object. For dependencies on other stacks, returns the Stack object. The order of the array is not guaranteed.
overrideLogicalId(newLogicalId: string): voiddef override_logical_id(self, new_logical_id: str) -> Nonepublic void overrideLogicalId(String newLogicalId)public void OverrideLogicalId(string newLogicalId)func OverrideLogicalId(NewLogicalId *string)#1 parameter
Parameters
newLogicalIdnew_logical_idnewLogicalIdnewLogicalIdNewLogicalId— The new logical ID to use for this stack element.
removeDependency(target: CfnResource): voiddef remove_dependency(self, target: CfnResource) -> Nonepublic void removeDependency(CfnResource target)public void RemoveDependency(CfnResource target)func RemoveDependency(Target CfnResource)deprecated#This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
removeResourceDependency(target: CfnResource): voiddef remove_resource_dependency(self, target: CfnResource) -> Nonepublic void removeResourceDependency(CfnResource target)public void RemoveResourceDependency(CfnResource target)func RemoveResourceDependency(Target CfnResource)#This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
replaceDependency(target: CfnResource, newTarget: CfnResource): voiddef replace_dependency(self, target: CfnResource, new_target: CfnResource) -> Nonepublic void replaceDependency(CfnResource target, CfnResource newTarget)public void ReplaceDependency(CfnResource target, CfnResource newTarget)func ReplaceDependency(Target CfnResource, NewTarget CfnResource)#2 parameters
Parameters
targettargettargettargetTarget— The dependency to replace.newTargetnew_targetnewTargetnewTargetNewTarget— The new dependency to add.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#returns
Returns: a string representation of this resource
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.