From d99e8b0aaf8afcf4d20a37d6cb022443bedd3fd7 Mon Sep 17 00:00:00 2001 From: Kazuho CryerShinozuka Date: Sat, 16 Nov 2024 00:25:01 +0900 Subject: [PATCH 01/11] add integ test --- ...efaultTestDeployAssertBBA17BDD.assets.json | 19 + ...aultTestDeployAssertBBA17BDD.template.json | 36 + ...ncedMonitoringClusterTestStack.assets.json | 32 + ...edMonitoringClusterTestStack.template.json | 851 +++++++++++++ .../__entrypoint__.js | 155 +++ .../index.js | 1 + .../cdk.out | 1 + .../integ.json | 12 + .../manifest.json | 319 +++++ .../tree.json | 1108 +++++++++++++++++ .../test/integ.cluster-enhanced-monitoring.ts | 20 + packages/aws-cdk-lib/aws-rds/lib/cluster.ts | 32 +- 12 files changed, 2584 insertions(+), 2 deletions(-) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/__entrypoint__.js create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/index.js create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json new file mode 100644 index 0000000000000..b4c032e30b311 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json new file mode 100644 index 0000000000000..756e653b2740d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json @@ -0,0 +1,32 @@ +{ + "version": "38.0.1", + "files": { + "a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c": { + "source": { + "path": "asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "fa291794217dc1905a6ad35ccdccfb5bcb931a0760adebd6704ba704c700aa3d": { + "source": { + "path": "EnhancedMonitoringClusterTestStack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "fa291794217dc1905a6ad35ccdccfb5bcb931a0760adebd6704ba704c700aa3d.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.template.json new file mode 100644 index 0000000000000..18b11dbcc2c8c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.template.json @@ -0,0 +1,851 @@ +{ + "Resources": { + "Vpc8378EB38": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc" + } + ] + } + }, + "VpcPublicSubnet1Subnet5C2D37C4": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.0.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPublicSubnet1RouteTable6C95E38E": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPublicSubnet1RouteTableAssociation97140677": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + } + } + }, + "VpcPublicSubnet1DefaultRoute3DA9E72A": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + } + }, + "DependsOn": [ + "VpcVPCGWBF912B6E" + ] + }, + "VpcPublicSubnet1EIPD7E02669": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + } + ] + } + }, + "VpcPublicSubnet1NATGateway4D7517AA": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet1EIPD7E02669", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + } + ] + }, + "DependsOn": [ + "VpcPublicSubnet1DefaultRoute3DA9E72A", + "VpcPublicSubnet1RouteTableAssociation97140677" + ] + }, + "VpcPublicSubnet2Subnet691E08A3": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.64.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPublicSubnet2RouteTable94F7E489": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPublicSubnet2RouteTableAssociationDD5762D8": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + }, + "SubnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + } + } + }, + "VpcPublicSubnet2DefaultRoute97F91067": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "RouteTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + } + }, + "DependsOn": [ + "VpcVPCGWBF912B6E" + ] + }, + "VpcPublicSubnet2EIP3C605A87": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + } + ] + } + }, + "VpcPublicSubnet2NATGateway9182C01D": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet2EIP3C605A87", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + }, + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + } + ] + }, + "DependsOn": [ + "VpcPublicSubnet2DefaultRoute97F91067", + "VpcPublicSubnet2RouteTableAssociationDD5762D8" + ] + }, + "VpcPrivateSubnet1Subnet536B997A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPrivateSubnet1RouteTableB2C5B500": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPrivateSubnet1RouteTableAssociation70C59FA6": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "SubnetId": { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + } + }, + "VpcPrivateSubnet1DefaultRouteBE02A9ED": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VpcPublicSubnet1NATGateway4D7517AA" + }, + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + } + } + }, + "VpcPrivateSubnet2Subnet3788AAA1": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.192.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPrivateSubnet2RouteTableA678073B": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPrivateSubnet2RouteTableAssociationA89CAD56": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + }, + "SubnetId": { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + } + }, + "VpcPrivateSubnet2DefaultRoute060D2087": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VpcPublicSubnet2NATGateway9182C01D" + }, + "RouteTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + } + } + }, + "VpcIGWD7BA715C": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterTestStack/Vpc" + } + ] + } + }, + "VpcVPCGWBF912B6E": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "InternetGatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcRestrictDefaultSecurityGroupCustomResourceC73DA2BE": { + "Type": "Custom::VpcRestrictDefaultSG", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E", + "Arn" + ] + }, + "DefaultSecurityGroupId": { + "Fn::GetAtt": [ + "Vpc8378EB38", + "DefaultSecurityGroup" + ] + }, + "Account": { + "Ref": "AWS::AccountId" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ] + }, + "ManagedPolicyArns": [ + { + "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + } + ], + "Policies": [ + { + "PolicyName": "Inline", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "ec2:AuthorizeSecurityGroupIngress", + "ec2:AuthorizeSecurityGroupEgress", + "ec2:RevokeSecurityGroupIngress", + "ec2:RevokeSecurityGroupEgress" + ], + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":security-group/", + { + "Fn::GetAtt": [ + "Vpc8378EB38", + "DefaultSecurityGroup" + ] + } + ] + ] + } + ] + } + ] + } + } + ] + } + }, + "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c.zip" + }, + "Timeout": 900, + "MemorySize": 128, + "Handler": "__entrypoint__.handler", + "Role": { + "Fn::GetAtt": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0", + "Arn" + ] + }, + "Runtime": { + "Fn::FindInMap": [ + "LatestNodeRuntimeMap", + { + "Ref": "AWS::Region" + }, + "value" + ] + }, + "Description": "Lambda function for removing all inbound/outbound rules from the VPC default security group" + }, + "DependsOn": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" + ] + }, + "DatabaseSubnets56F17B9A": { + "Type": "AWS::RDS::DBSubnetGroup", + "Properties": { + "DBSubnetGroupDescription": "Subnets for Database database", + "SubnetIds": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ] + } + }, + "DatabaseSecurityGroup5C91FDCB": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "RDS security group", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "DatabaseMonitoringRoleForCluster91F5067E": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "monitoring.rds.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole" + ] + ] + } + ] + } + }, + "DatabaseSecret3B817195": { + "Type": "AWS::SecretsManager::Secret", + "Properties": { + "Description": { + "Fn::Join": [ + "", + [ + "Generated by the CDK for stack: ", + { + "Ref": "AWS::StackName" + } + ] + ] + }, + "GenerateSecretString": { + "ExcludeCharacters": " %+~`#$&*()|[]{}:;<>?!'/@\"\\", + "GenerateStringKey": "password", + "PasswordLength": 30, + "SecretStringTemplate": "{\"username\":\"postgres\"}" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "DatabaseSecretAttachmentE5D1B020": { + "Type": "AWS::SecretsManager::SecretTargetAttachment", + "Properties": { + "SecretId": { + "Ref": "DatabaseSecret3B817195" + }, + "TargetId": { + "Ref": "DatabaseB269D8BB" + }, + "TargetType": "AWS::RDS::DBCluster" + } + }, + "DatabaseB269D8BB": { + "Type": "AWS::RDS::DBCluster", + "Properties": { + "CopyTagsToSnapshot": true, + "DBClusterParameterGroupName": "default.aurora-postgresql16", + "DBSubnetGroupName": { + "Ref": "DatabaseSubnets56F17B9A" + }, + "Engine": "aurora-postgresql", + "EngineVersion": "16.1", + "MasterUserPassword": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "DatabaseSecret3B817195" + }, + ":SecretString:password::}}" + ] + ] + }, + "MasterUsername": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "DatabaseSecret3B817195" + }, + ":SecretString:username::}}" + ] + ] + }, + "MonitoringInterval": 5, + "MonitoringRoleArn": { + "Fn::GetAtt": [ + "DatabaseMonitoringRoleForCluster91F5067E", + "Arn" + ] + }, + "Port": 5432, + "ServerlessV2ScalingConfiguration": { + "MaxCapacity": 2, + "MinCapacity": 0.5 + }, + "VpcSecurityGroupIds": [ + { + "Fn::GetAtt": [ + "DatabaseSecurityGroup5C91FDCB", + "GroupId" + ] + } + ] + }, + "UpdateReplacePolicy": "Snapshot", + "DeletionPolicy": "Snapshot" + }, + "DatabasewriterInstanceEBFCC003": { + "Type": "AWS::RDS::DBInstance", + "Properties": { + "DBClusterIdentifier": { + "Ref": "DatabaseB269D8BB" + }, + "DBInstanceClass": "db.serverless", + "Engine": "aurora-postgresql", + "PromotionTier": 0 + }, + "DependsOn": [ + "VpcPrivateSubnet1DefaultRouteBE02A9ED", + "VpcPrivateSubnet1RouteTableAssociation70C59FA6", + "VpcPrivateSubnet2DefaultRoute060D2087", + "VpcPrivateSubnet2RouteTableAssociationA89CAD56" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + }, + "Mappings": { + "LatestNodeRuntimeMap": { + "af-south-1": { + "value": "nodejs20.x" + }, + "ap-east-1": { + "value": "nodejs20.x" + }, + "ap-northeast-1": { + "value": "nodejs20.x" + }, + "ap-northeast-2": { + "value": "nodejs20.x" + }, + "ap-northeast-3": { + "value": "nodejs20.x" + }, + "ap-south-1": { + "value": "nodejs20.x" + }, + "ap-south-2": { + "value": "nodejs20.x" + }, + "ap-southeast-1": { + "value": "nodejs20.x" + }, + "ap-southeast-2": { + "value": "nodejs20.x" + }, + "ap-southeast-3": { + "value": "nodejs20.x" + }, + "ap-southeast-4": { + "value": "nodejs20.x" + }, + "ap-southeast-5": { + "value": "nodejs20.x" + }, + "ap-southeast-7": { + "value": "nodejs20.x" + }, + "ca-central-1": { + "value": "nodejs20.x" + }, + "ca-west-1": { + "value": "nodejs20.x" + }, + "cn-north-1": { + "value": "nodejs18.x" + }, + "cn-northwest-1": { + "value": "nodejs18.x" + }, + "eu-central-1": { + "value": "nodejs20.x" + }, + "eu-central-2": { + "value": "nodejs20.x" + }, + "eu-isoe-west-1": { + "value": "nodejs18.x" + }, + "eu-north-1": { + "value": "nodejs20.x" + }, + "eu-south-1": { + "value": "nodejs20.x" + }, + "eu-south-2": { + "value": "nodejs20.x" + }, + "eu-west-1": { + "value": "nodejs20.x" + }, + "eu-west-2": { + "value": "nodejs20.x" + }, + "eu-west-3": { + "value": "nodejs20.x" + }, + "il-central-1": { + "value": "nodejs20.x" + }, + "me-central-1": { + "value": "nodejs20.x" + }, + "me-south-1": { + "value": "nodejs20.x" + }, + "mx-central-1": { + "value": "nodejs20.x" + }, + "sa-east-1": { + "value": "nodejs20.x" + }, + "us-east-1": { + "value": "nodejs20.x" + }, + "us-east-2": { + "value": "nodejs20.x" + }, + "us-gov-east-1": { + "value": "nodejs18.x" + }, + "us-gov-west-1": { + "value": "nodejs18.x" + }, + "us-iso-east-1": { + "value": "nodejs18.x" + }, + "us-iso-west-1": { + "value": "nodejs18.x" + }, + "us-isob-east-1": { + "value": "nodejs18.x" + }, + "us-west-1": { + "value": "nodejs20.x" + }, + "us-west-2": { + "value": "nodejs20.x" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/__entrypoint__.js new file mode 100644 index 0000000000000..ff3a517fba12d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/__entrypoint__.js @@ -0,0 +1,155 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.external = void 0; +exports.handler = handler; +exports.withRetries = withRetries; +const https = require("https"); +const url = require("url"); +// for unit tests +exports.external = { + sendHttpRequest: defaultSendHttpRequest, + log: defaultLog, + includeStackTraces: true, + userHandlerIndex: './index', +}; +const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; +const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; +async function handler(event, context) { + const sanitizedEvent = { ...event, ResponseURL: '...' }; + exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); + // ignore DELETE event when the physical resource ID is the marker that + // indicates that this DELETE is a subsequent DELETE to a failed CREATE + // operation. + if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { + exports.external.log('ignoring DELETE event caused by a failed CREATE event'); + await submitResponse('SUCCESS', event); + return; + } + try { + // invoke the user handler. this is intentionally inside the try-catch to + // ensure that if there is an error it's reported as a failure to + // cloudformation (otherwise cfn waits). + // eslint-disable-next-line @typescript-eslint/no-require-imports + const userHandler = require(exports.external.userHandlerIndex).handler; + const result = await userHandler(sanitizedEvent, context); + // validate user response and create the combined event + const responseEvent = renderResponse(event, result); + // submit to cfn as success + await submitResponse('SUCCESS', responseEvent); + } + catch (e) { + const resp = { + ...event, + Reason: exports.external.includeStackTraces ? e.stack : e.message, + }; + if (!resp.PhysicalResourceId) { + // special case: if CREATE fails, which usually implies, we usually don't + // have a physical resource id. in this case, the subsequent DELETE + // operation does not have any meaning, and will likely fail as well. to + // address this, we use a marker so the provider framework can simply + // ignore the subsequent DELETE. + if (event.RequestType === 'Create') { + exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); + resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; + } + else { + // otherwise, if PhysicalResourceId is not specified, something is + // terribly wrong because all other events should have an ID. + exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); + } + } + // this is an actual error, fail the activity altogether and exist. + await submitResponse('FAILED', resp); + } +} +function renderResponse(cfnRequest, handlerResponse = {}) { + // if physical ID is not returned, we have some defaults for you based + // on the request type. + const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; + // if we are in DELETE and physical ID was changed, it's an error. + if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { + throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); + } + // merge request event and result event (result prevails). + return { + ...cfnRequest, + ...handlerResponse, + PhysicalResourceId: physicalResourceId, + }; +} +async function submitResponse(status, event) { + const json = { + Status: status, + Reason: event.Reason ?? status, + StackId: event.StackId, + RequestId: event.RequestId, + PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, + LogicalResourceId: event.LogicalResourceId, + NoEcho: event.NoEcho, + Data: event.Data, + }; + const parsedUrl = url.parse(event.ResponseURL); + const loggingSafeUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}/${parsedUrl.pathname}?***`; + exports.external.log('submit response to cloudformation', loggingSafeUrl, json); + const responseBody = JSON.stringify(json); + const req = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { + 'content-type': '', + 'content-length': Buffer.byteLength(responseBody, 'utf8'), + }, + }; + const retryOptions = { + attempts: 5, + sleep: 1000, + }; + await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); +} +async function defaultSendHttpRequest(options, requestBody) { + return new Promise((resolve, reject) => { + try { + const request = https.request(options, (response) => { + response.resume(); // Consume the response but don't care about it + if (!response.statusCode || response.statusCode >= 400) { + reject(new Error(`Unsuccessful HTTP response: ${response.statusCode}`)); + } + else { + resolve(); + } + }); + request.on('error', reject); + request.write(requestBody); + request.end(); + } + catch (e) { + reject(e); + } + }); +} +function defaultLog(fmt, ...params) { + // eslint-disable-next-line no-console + console.log(fmt, ...params); +} +function withRetries(options, fn) { + return async (...xs) => { + let attempts = options.attempts; + let ms = options.sleep; + while (true) { + try { + return await fn(...xs); + } + catch (e) { + if (attempts-- <= 0) { + throw e; + } + await sleep(Math.floor(Math.random() * ms)); + ms *= 2; + } + } + }; +} +async function sleep(ms) { + return new Promise((ok) => setTimeout(ok, ms)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/index.js new file mode 100644 index 0000000000000..013bcaffd8fe5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/index.js @@ -0,0 +1 @@ +"use strict";var I=Object.create;var t=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var G=(r,e)=>{for(var o in e)t(r,o,{get:e[o],enumerable:!0})},n=(r,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of P(e))!l.call(r,s)&&s!==o&&t(r,s,{get:()=>e[s],enumerable:!(i=y(e,s))||i.enumerable});return r};var R=(r,e,o)=>(o=r!=null?I(g(r)):{},n(e||!r||!r.__esModule?t(o,"default",{value:r,enumerable:!0}):o,r)),S=r=>n(t({},"__esModule",{value:!0}),r);var k={};G(k,{handler:()=>f});module.exports=S(k);var a=R(require("@aws-sdk/client-ec2")),u=new a.EC2({});function c(r,e){return{GroupId:r,IpPermissions:[{UserIdGroupPairs:[{GroupId:r,UserId:e}],IpProtocol:"-1"}]}}function d(r){return{GroupId:r,IpPermissions:[{IpRanges:[{CidrIp:"0.0.0.0/0"}],IpProtocol:"-1"}]}}async function f(r){let e=r.ResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.Account;switch(r.RequestType){case"Create":return p(e,o);case"Update":return h(r);case"Delete":return m(e,o)}}async function h(r){let e=r.OldResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.DefaultSecurityGroupId;e!==o&&(await m(e,r.ResourceProperties.Account),await p(o,r.ResourceProperties.Account))}async function p(r,e){try{await u.revokeSecurityGroupEgress(d(r))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}try{await u.revokeSecurityGroupIngress(c(r,e))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}}async function m(r,e){await u.authorizeSecurityGroupIngress(c(r,e)),await u.authorizeSecurityGroupEgress(d(r))}0&&(module.exports={handler}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/cdk.out new file mode 100644 index 0000000000000..c6e612584e352 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/integ.json new file mode 100644 index 0000000000000..bc672af16446a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "EnhancedMonitoringClusterInteg/DefaultTest": { + "stacks": [ + "EnhancedMonitoringClusterTestStack" + ], + "assertionStack": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert", + "assertionStackName": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/manifest.json new file mode 100644 index 0000000000000..6ef65c6dc20dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/manifest.json @@ -0,0 +1,319 @@ +{ + "version": "38.0.1", + "artifacts": { + "EnhancedMonitoringClusterTestStack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "EnhancedMonitoringClusterTestStack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "EnhancedMonitoringClusterTestStack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "EnhancedMonitoringClusterTestStack.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/fa291794217dc1905a6ad35ccdccfb5bcb931a0760adebd6704ba704c700aa3d.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "EnhancedMonitoringClusterTestStack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "EnhancedMonitoringClusterTestStack.assets" + ], + "metadata": { + "/EnhancedMonitoringClusterTestStack/Vpc/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Vpc8378EB38" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1Subnet5C2D37C4" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1RouteTable6C95E38E" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1RouteTableAssociation97140677" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1DefaultRoute3DA9E72A" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1EIPD7E02669" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1NATGateway4D7517AA" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2Subnet691E08A3" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2RouteTable94F7E489" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2RouteTableAssociationDD5762D8" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2DefaultRoute97F91067" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2EIP3C605A87" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2NATGateway9182C01D" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1Subnet536B997A" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1RouteTableB2C5B500" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1RouteTableAssociation70C59FA6" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1DefaultRouteBE02A9ED" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2Subnet3788AAA1" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2RouteTableA678073B" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2RouteTableAssociationA89CAD56" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2DefaultRoute060D2087" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcIGWD7BA715C" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/VPCGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcVPCGWBF912B6E" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/RestrictDefaultSecurityGroupCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcRestrictDefaultSecurityGroupCustomResourceC73DA2BE" + } + ], + "/EnhancedMonitoringClusterTestStack/LatestNodeRuntimeMap": [ + { + "type": "aws:cdk:logicalId", + "data": "LatestNodeRuntimeMap" + } + ], + "/EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider": [ + { + "type": "aws:cdk:is-custom-resource-handler-customResourceProvider", + "data": true + } + ], + "/EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" + } + ], + "/EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/Subnets/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabaseSubnets56F17B9A" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabaseSecurityGroup5C91FDCB" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/MonitoringRoleForCluster/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabaseMonitoringRoleForCluster91F5067E" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/Secret/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabaseSecret3B817195" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/Secret/Attachment/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabaseSecretAttachmentE5D1B020" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabaseB269D8BB" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/writerInstance/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabasewriterInstanceEBFCC003" + } + ], + "/EnhancedMonitoringClusterTestStack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/EnhancedMonitoringClusterTestStack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "EnhancedMonitoringClusterTestStack" + }, + "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets" + ], + "metadata": { + "/EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/tree.json new file mode 100644 index 0000000000000..9890beda78c2c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/tree.json @@ -0,0 +1,1108 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "EnhancedMonitoringClusterTestStack": { + "id": "EnhancedMonitoringClusterTestStack", + "path": "EnhancedMonitoringClusterTestStack", + "children": { + "Vpc": { + "id": "Vpc", + "path": "EnhancedMonitoringClusterTestStack/Vpc", + "children": { + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Vpc/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPC", + "aws:cdk:cloudformation:props": { + "cidrBlock": "10.0.0.0/16", + "enableDnsHostnames": true, + "enableDnsSupport": true, + "instanceTenancy": "default", + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "PublicSubnet1": { + "id": "PublicSubnet1", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.0.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Acl": { + "id": "Acl", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/Acl", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "subnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "routeTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "EIP": { + "id": "EIP", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "allocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet1EIPD7E02669", + "AllocationId" + ] + }, + "subnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + }, + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "PublicSubnet2": { + "id": "PublicSubnet2", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.64.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Acl": { + "id": "Acl", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/Acl", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + }, + "subnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "routeTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "EIP": { + "id": "EIP", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "allocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet2EIP3C605A87", + "AllocationId" + ] + }, + "subnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + }, + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "PrivateSubnet1": { + "id": "PrivateSubnet1", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.128.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Acl": { + "id": "Acl", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/Acl", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "subnetId": { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VpcPublicSubnet1NATGateway4D7517AA" + }, + "routeTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "PrivateSubnet2": { + "id": "PrivateSubnet2", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.192.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Acl": { + "id": "Acl", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/Acl", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + }, + "subnetId": { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VpcPublicSubnet2NATGateway9182C01D" + }, + "routeTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "IGW": { + "id": "IGW", + "path": "EnhancedMonitoringClusterTestStack/Vpc/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "VPCGW": { + "id": "VPCGW", + "path": "EnhancedMonitoringClusterTestStack/Vpc/VPCGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "internetGatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RestrictDefaultSecurityGroupCustomResource": { + "id": "RestrictDefaultSecurityGroupCustomResource", + "path": "EnhancedMonitoringClusterTestStack/Vpc/RestrictDefaultSecurityGroupCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "EnhancedMonitoringClusterTestStack/Vpc/RestrictDefaultSecurityGroupCustomResource/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "LatestNodeRuntimeMap": { + "id": "LatestNodeRuntimeMap", + "path": "EnhancedMonitoringClusterTestStack/LatestNodeRuntimeMap", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Custom::VpcRestrictDefaultSGCustomResourceProvider": { + "id": "Custom::VpcRestrictDefaultSGCustomResourceProvider", + "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider", + "children": { + "Staging": { + "id": "Staging", + "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Role": { + "id": "Role", + "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Handler": { + "id": "Handler", + "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Database": { + "id": "Database", + "path": "EnhancedMonitoringClusterTestStack/Database", + "children": { + "Subnets": { + "id": "Subnets", + "path": "EnhancedMonitoringClusterTestStack/Database/Subnets", + "children": { + "Default": { + "id": "Default", + "path": "EnhancedMonitoringClusterTestStack/Database/Subnets/Default", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::RDS::DBSubnetGroup", + "aws:cdk:cloudformation:props": { + "dbSubnetGroupDescription": "Subnets for Database database", + "subnetIds": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "SecurityGroup": { + "id": "SecurityGroup", + "path": "EnhancedMonitoringClusterTestStack/Database/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Database/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "RDS security group", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup": { + "id": "AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup", + "path": "EnhancedMonitoringClusterTestStack/Database/AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "MonitoringRoleForCluster": { + "id": "MonitoringRoleForCluster", + "path": "EnhancedMonitoringClusterTestStack/Database/MonitoringRoleForCluster", + "children": { + "ImportMonitoringRoleForCluster": { + "id": "ImportMonitoringRoleForCluster", + "path": "EnhancedMonitoringClusterTestStack/Database/MonitoringRoleForCluster/ImportMonitoringRoleForCluster", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Database/MonitoringRoleForCluster/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "monitoring.rds.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Secret": { + "id": "Secret", + "path": "EnhancedMonitoringClusterTestStack/Database/Secret", + "children": { + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Database/Secret/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SecretsManager::Secret", + "aws:cdk:cloudformation:props": { + "description": { + "Fn::Join": [ + "", + [ + "Generated by the CDK for stack: ", + { + "Ref": "AWS::StackName" + } + ] + ] + }, + "generateSecretString": { + "passwordLength": 30, + "secretStringTemplate": "{\"username\":\"postgres\"}", + "generateStringKey": "password", + "excludeCharacters": " %+~`#$&*()|[]{}:;<>?!'/@\"\\" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Attachment": { + "id": "Attachment", + "path": "EnhancedMonitoringClusterTestStack/Database/Secret/Attachment", + "children": { + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Database/Secret/Attachment/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SecretsManager::SecretTargetAttachment", + "aws:cdk:cloudformation:props": { + "secretId": { + "Ref": "DatabaseSecret3B817195" + }, + "targetId": { + "Ref": "DatabaseB269D8BB" + }, + "targetType": "AWS::RDS::DBCluster" + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Database/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::RDS::DBCluster", + "aws:cdk:cloudformation:props": { + "copyTagsToSnapshot": true, + "dbClusterParameterGroupName": "default.aurora-postgresql16", + "dbSubnetGroupName": { + "Ref": "DatabaseSubnets56F17B9A" + }, + "engine": "aurora-postgresql", + "engineVersion": "16.1", + "masterUsername": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "DatabaseSecret3B817195" + }, + ":SecretString:username::}}" + ] + ] + }, + "masterUserPassword": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "DatabaseSecret3B817195" + }, + ":SecretString:password::}}" + ] + ] + }, + "monitoringInterval": 5, + "monitoringRoleArn": { + "Fn::GetAtt": [ + "DatabaseMonitoringRoleForCluster91F5067E", + "Arn" + ] + }, + "port": 5432, + "serverlessV2ScalingConfiguration": { + "minCapacity": 0.5, + "maxCapacity": 2 + }, + "vpcSecurityGroupIds": [ + { + "Fn::GetAtt": [ + "DatabaseSecurityGroup5C91FDCB", + "GroupId" + ] + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "writerInstance": { + "id": "writerInstance", + "path": "EnhancedMonitoringClusterTestStack/Database/writerInstance", + "children": { + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Database/writerInstance/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::RDS::DBInstance", + "aws:cdk:cloudformation:props": { + "dbClusterIdentifier": { + "Ref": "DatabaseB269D8BB" + }, + "dbInstanceClass": "db.serverless", + "engine": "aurora-postgresql", + "promotionTier": 0 + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "EnhancedMonitoringClusterTestStack/BootstrapVersion", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "EnhancedMonitoringClusterTestStack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "EnhancedMonitoringClusterInteg": { + "id": "EnhancedMonitoringClusterInteg", + "path": "EnhancedMonitoringClusterInteg", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "EnhancedMonitoringClusterInteg/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "EnhancedMonitoringClusterInteg/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.ts new file mode 100644 index 0000000000000..6039888fcd8bc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.ts @@ -0,0 +1,20 @@ +import * as cdk from 'aws-cdk-lib/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as rds from 'aws-cdk-lib/aws-rds'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'EnhancedMonitoringClusterTestStack'); +const vpc = new ec2.Vpc(stack, 'Vpc'); + +new rds.DatabaseCluster(stack, 'Database', { + engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_16_1 }), + writer: rds.ClusterInstance.serverlessV2('writerInstance'), + vpc, + monitoringIntervalForCluster: cdk.Duration.seconds(5), +}); + +new IntegTest(app, 'EnhancedMonitoringClusterInteg', { + testCases: [stack], +}); diff --git a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts index e858c462795d1..9cba7d6b6ceb4 100644 --- a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts @@ -234,10 +234,10 @@ interface DatabaseClusterBaseProps { readonly cloudwatchLogsRetentionRole?: IRole; /** - * The interval, in seconds, between points when Amazon RDS collects enhanced + * The interval between points when Amazon RDS collects enhanced * monitoring metrics for the DB instances. * - * @default no enhanced monitoring + * @default - no enhanced monitoring */ readonly monitoringInterval?: Duration; @@ -248,6 +248,21 @@ interface DatabaseClusterBaseProps { */ readonly monitoringRole?: IRole; + /** + * The interval between points when Amazon RDS collects enhanced + * monitoring metrics for the DB instances. + * + * @default - no enhanced monitoring + */ + readonly monitoringIntervalForCluster?: Duration; + + /** + * Role that will be used to manage DB instances monitoring. + * + * @default - A role is automatically created for you + */ + readonly monitoringRoleForCluster?: IRole; + /** * Role that will be associated with this DB cluster to enable S3 import. * This feature is only supported by the Aurora database engine. @@ -758,6 +773,17 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { : undefined; this.performanceInsightEncryptionKey = props.performanceInsightEncryptionKey; + // configure enhanced monitoring role for the cluster + let monitoringRoleForCluster = props.monitoringRoleForCluster; + if (!props.monitoringRoleForCluster && props.monitoringIntervalForCluster && props.monitoringIntervalForCluster.toSeconds()) { + monitoringRoleForCluster = new Role(this, 'MonitoringRoleForCluster', { + assumedBy: new ServicePrincipal('monitoring.rds.amazonaws.com'), + managedPolicies: [ + ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole'), + ], + }); + } + this.newCfnProps = { // Basic engine: props.engine.engineType, @@ -803,6 +829,8 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { performanceInsightsKmsKeyId: this.performanceInsightEncryptionKey?.keyArn, performanceInsightsRetentionPeriod: this.performanceInsightRetention, autoMinorVersionUpgrade: props.autoMinorVersionUpgrade, + monitoringInterval: props.monitoringIntervalForCluster?.toSeconds(), + monitoringRoleArn: monitoringRoleForCluster?.roleArn, }; } From fd1c1701a0d79f6a9db32f5b5452b019f099d066 Mon Sep 17 00:00:00 2001 From: Kazuho CryerShinozuka Date: Sat, 16 Nov 2024 21:28:18 +0900 Subject: [PATCH 02/11] rename parameter --- ...EnhancedMonitoringClusterStack.assets.json | 32 + ...hancedMonitoringClusterStack.template.json | 851 +++++++++++++ .../integ.json | 2 +- .../manifest.json | 92 +- .../tree.json | 158 +-- .../test/integ.cluster-enhanced-monitoring.ts | 5 +- ...efaultTestDeployAssertBBA17BDD.assets.json | 19 + ...aultTestDeployAssertBBA17BDD.template.json | 36 + ...ncedMonitoringClusterTestStack.assets.json | 4 +- ...edMonitoringClusterTestStack.template.json | 11 +- .../__entrypoint__.js | 155 +++ .../index.js | 1 + .../test/integ.temp.js.snapshot/cdk.out | 1 + .../test/integ.temp.js.snapshot/integ.json | 12 + .../test/integ.temp.js.snapshot/manifest.json | 319 +++++ .../test/integ.temp.js.snapshot/tree.json | 1115 +++++++++++++++++ packages/aws-cdk-lib/aws-rds/lib/cluster.ts | 52 +- 17 files changed, 2700 insertions(+), 165 deletions(-) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterStack.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterStack.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json rename packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/{integ.cluster-enhanced-monitoring.js.snapshot => integ.temp.js.snapshot}/EnhancedMonitoringClusterTestStack.assets.json (87%) rename packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/{integ.cluster-enhanced-monitoring.js.snapshot => integ.temp.js.snapshot}/EnhancedMonitoringClusterTestStack.template.json (98%) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/__entrypoint__.js create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/index.js create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterStack.assets.json new file mode 100644 index 0000000000000..6898c269983d6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterStack.assets.json @@ -0,0 +1,32 @@ +{ + "version": "38.0.1", + "files": { + "a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c": { + "source": { + "path": "asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "d60ff43d1b2e79aa1a95e768fb9d42492b23015e340cbb5bd31d3a52d2717a1c": { + "source": { + "path": "EnhancedMonitoringClusterStack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "d60ff43d1b2e79aa1a95e768fb9d42492b23015e340cbb5bd31d3a52d2717a1c.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterStack.template.json new file mode 100644 index 0000000000000..5339df8c419f5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterStack.template.json @@ -0,0 +1,851 @@ +{ + "Resources": { + "Vpc8378EB38": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc" + } + ] + } + }, + "VpcPublicSubnet1Subnet5C2D37C4": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.0.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPublicSubnet1RouteTable6C95E38E": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPublicSubnet1RouteTableAssociation97140677": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + } + } + }, + "VpcPublicSubnet1DefaultRoute3DA9E72A": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + } + }, + "DependsOn": [ + "VpcVPCGWBF912B6E" + ] + }, + "VpcPublicSubnet1EIPD7E02669": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1" + } + ] + } + }, + "VpcPublicSubnet1NATGateway4D7517AA": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet1EIPD7E02669", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1" + } + ] + }, + "DependsOn": [ + "VpcPublicSubnet1DefaultRoute3DA9E72A", + "VpcPublicSubnet1RouteTableAssociation97140677" + ] + }, + "VpcPublicSubnet2Subnet691E08A3": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.64.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPublicSubnet2RouteTable94F7E489": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPublicSubnet2RouteTableAssociationDD5762D8": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + }, + "SubnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + } + } + }, + "VpcPublicSubnet2DefaultRoute97F91067": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "RouteTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + } + }, + "DependsOn": [ + "VpcVPCGWBF912B6E" + ] + }, + "VpcPublicSubnet2EIP3C605A87": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2" + } + ] + } + }, + "VpcPublicSubnet2NATGateway9182C01D": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet2EIP3C605A87", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + }, + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2" + } + ] + }, + "DependsOn": [ + "VpcPublicSubnet2DefaultRoute97F91067", + "VpcPublicSubnet2RouteTableAssociationDD5762D8" + ] + }, + "VpcPrivateSubnet1Subnet536B997A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPrivateSubnet1RouteTableB2C5B500": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPrivateSubnet1RouteTableAssociation70C59FA6": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "SubnetId": { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + } + }, + "VpcPrivateSubnet1DefaultRouteBE02A9ED": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VpcPublicSubnet1NATGateway4D7517AA" + }, + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + } + } + }, + "VpcPrivateSubnet2Subnet3788AAA1": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.192.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPrivateSubnet2RouteTableA678073B": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPrivateSubnet2RouteTableAssociationA89CAD56": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + }, + "SubnetId": { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + } + }, + "VpcPrivateSubnet2DefaultRoute060D2087": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VpcPublicSubnet2NATGateway9182C01D" + }, + "RouteTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + } + } + }, + "VpcIGWD7BA715C": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "EnhancedMonitoringClusterStack/Vpc" + } + ] + } + }, + "VpcVPCGWBF912B6E": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "InternetGatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcRestrictDefaultSecurityGroupCustomResourceC73DA2BE": { + "Type": "Custom::VpcRestrictDefaultSG", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E", + "Arn" + ] + }, + "DefaultSecurityGroupId": { + "Fn::GetAtt": [ + "Vpc8378EB38", + "DefaultSecurityGroup" + ] + }, + "Account": { + "Ref": "AWS::AccountId" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ] + }, + "ManagedPolicyArns": [ + { + "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + } + ], + "Policies": [ + { + "PolicyName": "Inline", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "ec2:AuthorizeSecurityGroupIngress", + "ec2:AuthorizeSecurityGroupEgress", + "ec2:RevokeSecurityGroupIngress", + "ec2:RevokeSecurityGroupEgress" + ], + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":security-group/", + { + "Fn::GetAtt": [ + "Vpc8378EB38", + "DefaultSecurityGroup" + ] + } + ] + ] + } + ] + } + ] + } + } + ] + } + }, + "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c.zip" + }, + "Timeout": 900, + "MemorySize": 128, + "Handler": "__entrypoint__.handler", + "Role": { + "Fn::GetAtt": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0", + "Arn" + ] + }, + "Runtime": { + "Fn::FindInMap": [ + "LatestNodeRuntimeMap", + { + "Ref": "AWS::Region" + }, + "value" + ] + }, + "Description": "Lambda function for removing all inbound/outbound rules from the VPC default security group" + }, + "DependsOn": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" + ] + }, + "DatabaseSubnets56F17B9A": { + "Type": "AWS::RDS::DBSubnetGroup", + "Properties": { + "DBSubnetGroupDescription": "Subnets for Database database", + "SubnetIds": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ] + } + }, + "DatabaseSecurityGroup5C91FDCB": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "RDS security group", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "DatabaseMonitoringRole576991DA": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "monitoring.rds.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole" + ] + ] + } + ] + } + }, + "DatabaseSecret3B817195": { + "Type": "AWS::SecretsManager::Secret", + "Properties": { + "Description": { + "Fn::Join": [ + "", + [ + "Generated by the CDK for stack: ", + { + "Ref": "AWS::StackName" + } + ] + ] + }, + "GenerateSecretString": { + "ExcludeCharacters": " %+~`#$&*()|[]{}:;<>?!'/@\"\\", + "GenerateStringKey": "password", + "PasswordLength": 30, + "SecretStringTemplate": "{\"username\":\"postgres\"}" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "DatabaseSecretAttachmentE5D1B020": { + "Type": "AWS::SecretsManager::SecretTargetAttachment", + "Properties": { + "SecretId": { + "Ref": "DatabaseSecret3B817195" + }, + "TargetId": { + "Ref": "DatabaseB269D8BB" + }, + "TargetType": "AWS::RDS::DBCluster" + } + }, + "DatabaseB269D8BB": { + "Type": "AWS::RDS::DBCluster", + "Properties": { + "CopyTagsToSnapshot": true, + "DBClusterParameterGroupName": "default.aurora-postgresql16", + "DBSubnetGroupName": { + "Ref": "DatabaseSubnets56F17B9A" + }, + "Engine": "aurora-postgresql", + "EngineVersion": "16.1", + "MasterUserPassword": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "DatabaseSecret3B817195" + }, + ":SecretString:password::}}" + ] + ] + }, + "MasterUsername": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "DatabaseSecret3B817195" + }, + ":SecretString:username::}}" + ] + ] + }, + "MonitoringInterval": 5, + "MonitoringRoleArn": { + "Fn::GetAtt": [ + "DatabaseMonitoringRole576991DA", + "Arn" + ] + }, + "Port": 5432, + "ServerlessV2ScalingConfiguration": { + "MaxCapacity": 2, + "MinCapacity": 0.5 + }, + "VpcSecurityGroupIds": [ + { + "Fn::GetAtt": [ + "DatabaseSecurityGroup5C91FDCB", + "GroupId" + ] + } + ] + }, + "UpdateReplacePolicy": "Snapshot", + "DeletionPolicy": "Snapshot" + }, + "DatabasewriterInstanceEBFCC003": { + "Type": "AWS::RDS::DBInstance", + "Properties": { + "DBClusterIdentifier": { + "Ref": "DatabaseB269D8BB" + }, + "DBInstanceClass": "db.serverless", + "Engine": "aurora-postgresql", + "PromotionTier": 0 + }, + "DependsOn": [ + "VpcPrivateSubnet1DefaultRouteBE02A9ED", + "VpcPrivateSubnet1RouteTableAssociation70C59FA6", + "VpcPrivateSubnet2DefaultRoute060D2087", + "VpcPrivateSubnet2RouteTableAssociationA89CAD56" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + }, + "Mappings": { + "LatestNodeRuntimeMap": { + "af-south-1": { + "value": "nodejs20.x" + }, + "ap-east-1": { + "value": "nodejs20.x" + }, + "ap-northeast-1": { + "value": "nodejs20.x" + }, + "ap-northeast-2": { + "value": "nodejs20.x" + }, + "ap-northeast-3": { + "value": "nodejs20.x" + }, + "ap-south-1": { + "value": "nodejs20.x" + }, + "ap-south-2": { + "value": "nodejs20.x" + }, + "ap-southeast-1": { + "value": "nodejs20.x" + }, + "ap-southeast-2": { + "value": "nodejs20.x" + }, + "ap-southeast-3": { + "value": "nodejs20.x" + }, + "ap-southeast-4": { + "value": "nodejs20.x" + }, + "ap-southeast-5": { + "value": "nodejs20.x" + }, + "ap-southeast-7": { + "value": "nodejs20.x" + }, + "ca-central-1": { + "value": "nodejs20.x" + }, + "ca-west-1": { + "value": "nodejs20.x" + }, + "cn-north-1": { + "value": "nodejs18.x" + }, + "cn-northwest-1": { + "value": "nodejs18.x" + }, + "eu-central-1": { + "value": "nodejs20.x" + }, + "eu-central-2": { + "value": "nodejs20.x" + }, + "eu-isoe-west-1": { + "value": "nodejs18.x" + }, + "eu-north-1": { + "value": "nodejs20.x" + }, + "eu-south-1": { + "value": "nodejs20.x" + }, + "eu-south-2": { + "value": "nodejs20.x" + }, + "eu-west-1": { + "value": "nodejs20.x" + }, + "eu-west-2": { + "value": "nodejs20.x" + }, + "eu-west-3": { + "value": "nodejs20.x" + }, + "il-central-1": { + "value": "nodejs20.x" + }, + "me-central-1": { + "value": "nodejs20.x" + }, + "me-south-1": { + "value": "nodejs20.x" + }, + "mx-central-1": { + "value": "nodejs20.x" + }, + "sa-east-1": { + "value": "nodejs20.x" + }, + "us-east-1": { + "value": "nodejs20.x" + }, + "us-east-2": { + "value": "nodejs20.x" + }, + "us-gov-east-1": { + "value": "nodejs18.x" + }, + "us-gov-west-1": { + "value": "nodejs18.x" + }, + "us-iso-east-1": { + "value": "nodejs18.x" + }, + "us-iso-west-1": { + "value": "nodejs18.x" + }, + "us-isob-east-1": { + "value": "nodejs18.x" + }, + "us-west-1": { + "value": "nodejs20.x" + }, + "us-west-2": { + "value": "nodejs20.x" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/integ.json index bc672af16446a..d622c0b7ce111 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/integ.json @@ -3,7 +3,7 @@ "testCases": { "EnhancedMonitoringClusterInteg/DefaultTest": { "stacks": [ - "EnhancedMonitoringClusterTestStack" + "EnhancedMonitoringClusterStack" ], "assertionStack": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert", "assertionStackName": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD" diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/manifest.json index 6ef65c6dc20dd..9796178643aea 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/manifest.json @@ -1,29 +1,29 @@ { "version": "38.0.1", "artifacts": { - "EnhancedMonitoringClusterTestStack.assets": { + "EnhancedMonitoringClusterStack.assets": { "type": "cdk:asset-manifest", "properties": { - "file": "EnhancedMonitoringClusterTestStack.assets.json", + "file": "EnhancedMonitoringClusterStack.assets.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" } }, - "EnhancedMonitoringClusterTestStack": { + "EnhancedMonitoringClusterStack": { "type": "aws:cloudformation:stack", "environment": "aws://unknown-account/unknown-region", "properties": { - "templateFile": "EnhancedMonitoringClusterTestStack.template.json", + "templateFile": "EnhancedMonitoringClusterStack.template.json", "terminationProtection": false, "validateOnSynth": false, "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/fa291794217dc1905a6ad35ccdccfb5bcb931a0760adebd6704ba704c700aa3d.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d60ff43d1b2e79aa1a95e768fb9d42492b23015e340cbb5bd31d3a52d2717a1c.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ - "EnhancedMonitoringClusterTestStack.assets" + "EnhancedMonitoringClusterStack.assets" ], "lookupRole": { "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", @@ -32,233 +32,233 @@ } }, "dependencies": [ - "EnhancedMonitoringClusterTestStack.assets" + "EnhancedMonitoringClusterStack.assets" ], "metadata": { - "/EnhancedMonitoringClusterTestStack/Vpc/Resource": [ + "/EnhancedMonitoringClusterStack/Vpc/Resource": [ { "type": "aws:cdk:logicalId", "data": "Vpc8378EB38" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/Subnet": [ + "/EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/Subnet": [ { "type": "aws:cdk:logicalId", "data": "VpcPublicSubnet1Subnet5C2D37C4" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTable": [ + "/EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/RouteTable": [ { "type": "aws:cdk:logicalId", "data": "VpcPublicSubnet1RouteTable6C95E38E" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTableAssociation": [ + "/EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", "data": "VpcPublicSubnet1RouteTableAssociation97140677" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/DefaultRoute": [ + "/EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/DefaultRoute": [ { "type": "aws:cdk:logicalId", "data": "VpcPublicSubnet1DefaultRoute3DA9E72A" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/EIP": [ + "/EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/EIP": [ { "type": "aws:cdk:logicalId", "data": "VpcPublicSubnet1EIPD7E02669" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/NATGateway": [ + "/EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/NATGateway": [ { "type": "aws:cdk:logicalId", "data": "VpcPublicSubnet1NATGateway4D7517AA" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/Subnet": [ + "/EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/Subnet": [ { "type": "aws:cdk:logicalId", "data": "VpcPublicSubnet2Subnet691E08A3" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTable": [ + "/EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/RouteTable": [ { "type": "aws:cdk:logicalId", "data": "VpcPublicSubnet2RouteTable94F7E489" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTableAssociation": [ + "/EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", "data": "VpcPublicSubnet2RouteTableAssociationDD5762D8" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/DefaultRoute": [ + "/EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/DefaultRoute": [ { "type": "aws:cdk:logicalId", "data": "VpcPublicSubnet2DefaultRoute97F91067" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/EIP": [ + "/EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/EIP": [ { "type": "aws:cdk:logicalId", "data": "VpcPublicSubnet2EIP3C605A87" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/NATGateway": [ + "/EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/NATGateway": [ { "type": "aws:cdk:logicalId", "data": "VpcPublicSubnet2NATGateway9182C01D" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/Subnet": [ + "/EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1/Subnet": [ { "type": "aws:cdk:logicalId", "data": "VpcPrivateSubnet1Subnet536B997A" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTable": [ + "/EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1/RouteTable": [ { "type": "aws:cdk:logicalId", "data": "VpcPrivateSubnet1RouteTableB2C5B500" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTableAssociation": [ + "/EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", "data": "VpcPrivateSubnet1RouteTableAssociation70C59FA6" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/DefaultRoute": [ + "/EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1/DefaultRoute": [ { "type": "aws:cdk:logicalId", "data": "VpcPrivateSubnet1DefaultRouteBE02A9ED" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/Subnet": [ + "/EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2/Subnet": [ { "type": "aws:cdk:logicalId", "data": "VpcPrivateSubnet2Subnet3788AAA1" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTable": [ + "/EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2/RouteTable": [ { "type": "aws:cdk:logicalId", "data": "VpcPrivateSubnet2RouteTableA678073B" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTableAssociation": [ + "/EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", "data": "VpcPrivateSubnet2RouteTableAssociationA89CAD56" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/DefaultRoute": [ + "/EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2/DefaultRoute": [ { "type": "aws:cdk:logicalId", "data": "VpcPrivateSubnet2DefaultRoute060D2087" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/IGW": [ + "/EnhancedMonitoringClusterStack/Vpc/IGW": [ { "type": "aws:cdk:logicalId", "data": "VpcIGWD7BA715C" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/VPCGW": [ + "/EnhancedMonitoringClusterStack/Vpc/VPCGW": [ { "type": "aws:cdk:logicalId", "data": "VpcVPCGWBF912B6E" } ], - "/EnhancedMonitoringClusterTestStack/Vpc/RestrictDefaultSecurityGroupCustomResource/Default": [ + "/EnhancedMonitoringClusterStack/Vpc/RestrictDefaultSecurityGroupCustomResource/Default": [ { "type": "aws:cdk:logicalId", "data": "VpcRestrictDefaultSecurityGroupCustomResourceC73DA2BE" } ], - "/EnhancedMonitoringClusterTestStack/LatestNodeRuntimeMap": [ + "/EnhancedMonitoringClusterStack/LatestNodeRuntimeMap": [ { "type": "aws:cdk:logicalId", "data": "LatestNodeRuntimeMap" } ], - "/EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider": [ + "/EnhancedMonitoringClusterStack/Custom::VpcRestrictDefaultSGCustomResourceProvider": [ { "type": "aws:cdk:is-custom-resource-handler-customResourceProvider", "data": true } ], - "/EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ + "/EnhancedMonitoringClusterStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ { "type": "aws:cdk:logicalId", "data": "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" } ], - "/EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler": [ + "/EnhancedMonitoringClusterStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler": [ { "type": "aws:cdk:logicalId", "data": "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E" } ], - "/EnhancedMonitoringClusterTestStack/Database/Subnets/Default": [ + "/EnhancedMonitoringClusterStack/Database/Subnets/Default": [ { "type": "aws:cdk:logicalId", "data": "DatabaseSubnets56F17B9A" } ], - "/EnhancedMonitoringClusterTestStack/Database/SecurityGroup/Resource": [ + "/EnhancedMonitoringClusterStack/Database/SecurityGroup/Resource": [ { "type": "aws:cdk:logicalId", "data": "DatabaseSecurityGroup5C91FDCB" } ], - "/EnhancedMonitoringClusterTestStack/Database/MonitoringRoleForCluster/Resource": [ + "/EnhancedMonitoringClusterStack/Database/MonitoringRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "DatabaseMonitoringRoleForCluster91F5067E" + "data": "DatabaseMonitoringRole576991DA" } ], - "/EnhancedMonitoringClusterTestStack/Database/Secret/Resource": [ + "/EnhancedMonitoringClusterStack/Database/Secret/Resource": [ { "type": "aws:cdk:logicalId", "data": "DatabaseSecret3B817195" } ], - "/EnhancedMonitoringClusterTestStack/Database/Secret/Attachment/Resource": [ + "/EnhancedMonitoringClusterStack/Database/Secret/Attachment/Resource": [ { "type": "aws:cdk:logicalId", "data": "DatabaseSecretAttachmentE5D1B020" } ], - "/EnhancedMonitoringClusterTestStack/Database/Resource": [ + "/EnhancedMonitoringClusterStack/Database/Resource": [ { "type": "aws:cdk:logicalId", "data": "DatabaseB269D8BB" } ], - "/EnhancedMonitoringClusterTestStack/Database/writerInstance/Resource": [ + "/EnhancedMonitoringClusterStack/Database/writerInstance/Resource": [ { "type": "aws:cdk:logicalId", "data": "DatabasewriterInstanceEBFCC003" } ], - "/EnhancedMonitoringClusterTestStack/BootstrapVersion": [ + "/EnhancedMonitoringClusterStack/BootstrapVersion": [ { "type": "aws:cdk:logicalId", "data": "BootstrapVersion" } ], - "/EnhancedMonitoringClusterTestStack/CheckBootstrapVersion": [ + "/EnhancedMonitoringClusterStack/CheckBootstrapVersion": [ { "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } ] }, - "displayName": "EnhancedMonitoringClusterTestStack" + "displayName": "EnhancedMonitoringClusterStack" }, "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets": { "type": "cdk:asset-manifest", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/tree.json index 9890beda78c2c..d0336eadff88c 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/tree.json @@ -4,17 +4,17 @@ "id": "App", "path": "", "children": { - "EnhancedMonitoringClusterTestStack": { - "id": "EnhancedMonitoringClusterTestStack", - "path": "EnhancedMonitoringClusterTestStack", + "EnhancedMonitoringClusterStack": { + "id": "EnhancedMonitoringClusterStack", + "path": "EnhancedMonitoringClusterStack", "children": { "Vpc": { "id": "Vpc", - "path": "EnhancedMonitoringClusterTestStack/Vpc", + "path": "EnhancedMonitoringClusterStack/Vpc", "children": { "Resource": { "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Vpc/Resource", + "path": "EnhancedMonitoringClusterStack/Vpc/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::VPC", "aws:cdk:cloudformation:props": { @@ -25,7 +25,7 @@ "tags": [ { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc" + "value": "EnhancedMonitoringClusterStack/Vpc" } ] } @@ -37,11 +37,11 @@ }, "PublicSubnet1": { "id": "PublicSubnet1", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1", "children": { "Subnet": { "id": "Subnet", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/Subnet", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/Subnet", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { @@ -66,7 +66,7 @@ }, { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + "value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1" } ], "vpcId": { @@ -81,7 +81,7 @@ }, "Acl": { "id": "Acl", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/Acl", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/Acl", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" @@ -89,14 +89,14 @@ }, "RouteTable": { "id": "RouteTable", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTable", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/RouteTable", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", "aws:cdk:cloudformation:props": { "tags": [ { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + "value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1" } ], "vpcId": { @@ -111,7 +111,7 @@ }, "RouteTableAssociation": { "id": "RouteTableAssociation", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTableAssociation", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/RouteTableAssociation", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", "aws:cdk:cloudformation:props": { @@ -130,7 +130,7 @@ }, "DefaultRoute": { "id": "DefaultRoute", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/DefaultRoute", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/DefaultRoute", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Route", "aws:cdk:cloudformation:props": { @@ -150,7 +150,7 @@ }, "EIP": { "id": "EIP", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/EIP", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/EIP", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::EIP", "aws:cdk:cloudformation:props": { @@ -158,7 +158,7 @@ "tags": [ { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + "value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1" } ] } @@ -170,7 +170,7 @@ }, "NATGateway": { "id": "NATGateway", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/NATGateway", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1/NATGateway", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", "aws:cdk:cloudformation:props": { @@ -186,7 +186,7 @@ "tags": [ { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + "value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet1" } ] } @@ -204,11 +204,11 @@ }, "PublicSubnet2": { "id": "PublicSubnet2", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2", "children": { "Subnet": { "id": "Subnet", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/Subnet", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/Subnet", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { @@ -233,7 +233,7 @@ }, { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + "value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2" } ], "vpcId": { @@ -248,7 +248,7 @@ }, "Acl": { "id": "Acl", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/Acl", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/Acl", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" @@ -256,14 +256,14 @@ }, "RouteTable": { "id": "RouteTable", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTable", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/RouteTable", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", "aws:cdk:cloudformation:props": { "tags": [ { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + "value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2" } ], "vpcId": { @@ -278,7 +278,7 @@ }, "RouteTableAssociation": { "id": "RouteTableAssociation", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTableAssociation", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/RouteTableAssociation", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", "aws:cdk:cloudformation:props": { @@ -297,7 +297,7 @@ }, "DefaultRoute": { "id": "DefaultRoute", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/DefaultRoute", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/DefaultRoute", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Route", "aws:cdk:cloudformation:props": { @@ -317,7 +317,7 @@ }, "EIP": { "id": "EIP", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/EIP", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/EIP", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::EIP", "aws:cdk:cloudformation:props": { @@ -325,7 +325,7 @@ "tags": [ { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + "value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2" } ] } @@ -337,7 +337,7 @@ }, "NATGateway": { "id": "NATGateway", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/NATGateway", + "path": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2/NATGateway", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", "aws:cdk:cloudformation:props": { @@ -353,7 +353,7 @@ "tags": [ { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + "value": "EnhancedMonitoringClusterStack/Vpc/PublicSubnet2" } ] } @@ -371,11 +371,11 @@ }, "PrivateSubnet1": { "id": "PrivateSubnet1", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1", + "path": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1", "children": { "Subnet": { "id": "Subnet", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/Subnet", + "path": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1/Subnet", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { @@ -400,7 +400,7 @@ }, { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1" + "value": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1" } ], "vpcId": { @@ -415,7 +415,7 @@ }, "Acl": { "id": "Acl", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/Acl", + "path": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1/Acl", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" @@ -423,14 +423,14 @@ }, "RouteTable": { "id": "RouteTable", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTable", + "path": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1/RouteTable", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", "aws:cdk:cloudformation:props": { "tags": [ { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1" + "value": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1" } ], "vpcId": { @@ -445,7 +445,7 @@ }, "RouteTableAssociation": { "id": "RouteTableAssociation", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTableAssociation", + "path": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1/RouteTableAssociation", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", "aws:cdk:cloudformation:props": { @@ -464,7 +464,7 @@ }, "DefaultRoute": { "id": "DefaultRoute", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/DefaultRoute", + "path": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet1/DefaultRoute", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Route", "aws:cdk:cloudformation:props": { @@ -490,11 +490,11 @@ }, "PrivateSubnet2": { "id": "PrivateSubnet2", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2", + "path": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2", "children": { "Subnet": { "id": "Subnet", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/Subnet", + "path": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2/Subnet", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { @@ -519,7 +519,7 @@ }, { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2" + "value": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2" } ], "vpcId": { @@ -534,7 +534,7 @@ }, "Acl": { "id": "Acl", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/Acl", + "path": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2/Acl", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" @@ -542,14 +542,14 @@ }, "RouteTable": { "id": "RouteTable", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTable", + "path": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2/RouteTable", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", "aws:cdk:cloudformation:props": { "tags": [ { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2" + "value": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2" } ], "vpcId": { @@ -564,7 +564,7 @@ }, "RouteTableAssociation": { "id": "RouteTableAssociation", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTableAssociation", + "path": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2/RouteTableAssociation", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", "aws:cdk:cloudformation:props": { @@ -583,7 +583,7 @@ }, "DefaultRoute": { "id": "DefaultRoute", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/DefaultRoute", + "path": "EnhancedMonitoringClusterStack/Vpc/PrivateSubnet2/DefaultRoute", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Route", "aws:cdk:cloudformation:props": { @@ -609,14 +609,14 @@ }, "IGW": { "id": "IGW", - "path": "EnhancedMonitoringClusterTestStack/Vpc/IGW", + "path": "EnhancedMonitoringClusterStack/Vpc/IGW", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", "aws:cdk:cloudformation:props": { "tags": [ { "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc" + "value": "EnhancedMonitoringClusterStack/Vpc" } ] } @@ -628,7 +628,7 @@ }, "VPCGW": { "id": "VPCGW", - "path": "EnhancedMonitoringClusterTestStack/Vpc/VPCGW", + "path": "EnhancedMonitoringClusterStack/Vpc/VPCGW", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", "aws:cdk:cloudformation:props": { @@ -647,11 +647,11 @@ }, "RestrictDefaultSecurityGroupCustomResource": { "id": "RestrictDefaultSecurityGroupCustomResource", - "path": "EnhancedMonitoringClusterTestStack/Vpc/RestrictDefaultSecurityGroupCustomResource", + "path": "EnhancedMonitoringClusterStack/Vpc/RestrictDefaultSecurityGroupCustomResource", "children": { "Default": { "id": "Default", - "path": "EnhancedMonitoringClusterTestStack/Vpc/RestrictDefaultSecurityGroupCustomResource/Default", + "path": "EnhancedMonitoringClusterStack/Vpc/RestrictDefaultSecurityGroupCustomResource/Default", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" @@ -671,7 +671,7 @@ }, "LatestNodeRuntimeMap": { "id": "LatestNodeRuntimeMap", - "path": "EnhancedMonitoringClusterTestStack/LatestNodeRuntimeMap", + "path": "EnhancedMonitoringClusterStack/LatestNodeRuntimeMap", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" @@ -679,11 +679,11 @@ }, "Custom::VpcRestrictDefaultSGCustomResourceProvider": { "id": "Custom::VpcRestrictDefaultSGCustomResourceProvider", - "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider", + "path": "EnhancedMonitoringClusterStack/Custom::VpcRestrictDefaultSGCustomResourceProvider", "children": { "Staging": { "id": "Staging", - "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", + "path": "EnhancedMonitoringClusterStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" @@ -691,7 +691,7 @@ }, "Role": { "id": "Role", - "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", + "path": "EnhancedMonitoringClusterStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" @@ -699,7 +699,7 @@ }, "Handler": { "id": "Handler", - "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", + "path": "EnhancedMonitoringClusterStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" @@ -713,15 +713,15 @@ }, "Database": { "id": "Database", - "path": "EnhancedMonitoringClusterTestStack/Database", + "path": "EnhancedMonitoringClusterStack/Database", "children": { "Subnets": { "id": "Subnets", - "path": "EnhancedMonitoringClusterTestStack/Database/Subnets", + "path": "EnhancedMonitoringClusterStack/Database/Subnets", "children": { "Default": { "id": "Default", - "path": "EnhancedMonitoringClusterTestStack/Database/Subnets/Default", + "path": "EnhancedMonitoringClusterStack/Database/Subnets/Default", "attributes": { "aws:cdk:cloudformation:type": "AWS::RDS::DBSubnetGroup", "aws:cdk:cloudformation:props": { @@ -749,11 +749,11 @@ }, "SecurityGroup": { "id": "SecurityGroup", - "path": "EnhancedMonitoringClusterTestStack/Database/SecurityGroup", + "path": "EnhancedMonitoringClusterStack/Database/SecurityGroup", "children": { "Resource": { "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Database/SecurityGroup/Resource", + "path": "EnhancedMonitoringClusterStack/Database/SecurityGroup/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", "aws:cdk:cloudformation:props": { @@ -783,19 +783,19 @@ }, "AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup": { "id": "AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup", - "path": "EnhancedMonitoringClusterTestStack/Database/AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup", + "path": "EnhancedMonitoringClusterStack/Database/AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" } }, - "MonitoringRoleForCluster": { - "id": "MonitoringRoleForCluster", - "path": "EnhancedMonitoringClusterTestStack/Database/MonitoringRoleForCluster", + "MonitoringRole": { + "id": "MonitoringRole", + "path": "EnhancedMonitoringClusterStack/Database/MonitoringRole", "children": { - "ImportMonitoringRoleForCluster": { - "id": "ImportMonitoringRoleForCluster", - "path": "EnhancedMonitoringClusterTestStack/Database/MonitoringRoleForCluster/ImportMonitoringRoleForCluster", + "ImportMonitoringRole": { + "id": "ImportMonitoringRole", + "path": "EnhancedMonitoringClusterStack/Database/MonitoringRole/ImportMonitoringRole", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" @@ -803,7 +803,7 @@ }, "Resource": { "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Database/MonitoringRoleForCluster/Resource", + "path": "EnhancedMonitoringClusterStack/Database/MonitoringRole/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Role", "aws:cdk:cloudformation:props": { @@ -848,11 +848,11 @@ }, "Secret": { "id": "Secret", - "path": "EnhancedMonitoringClusterTestStack/Database/Secret", + "path": "EnhancedMonitoringClusterStack/Database/Secret", "children": { "Resource": { "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Database/Secret/Resource", + "path": "EnhancedMonitoringClusterStack/Database/Secret/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::SecretsManager::Secret", "aws:cdk:cloudformation:props": { @@ -882,11 +882,11 @@ }, "Attachment": { "id": "Attachment", - "path": "EnhancedMonitoringClusterTestStack/Database/Secret/Attachment", + "path": "EnhancedMonitoringClusterStack/Database/Secret/Attachment", "children": { "Resource": { "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Database/Secret/Attachment/Resource", + "path": "EnhancedMonitoringClusterStack/Database/Secret/Attachment/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::SecretsManager::SecretTargetAttachment", "aws:cdk:cloudformation:props": { @@ -918,7 +918,7 @@ }, "Resource": { "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Database/Resource", + "path": "EnhancedMonitoringClusterStack/Database/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::RDS::DBCluster", "aws:cdk:cloudformation:props": { @@ -956,7 +956,7 @@ "monitoringInterval": 5, "monitoringRoleArn": { "Fn::GetAtt": [ - "DatabaseMonitoringRoleForCluster91F5067E", + "DatabaseMonitoringRole576991DA", "Arn" ] }, @@ -982,11 +982,11 @@ }, "writerInstance": { "id": "writerInstance", - "path": "EnhancedMonitoringClusterTestStack/Database/writerInstance", + "path": "EnhancedMonitoringClusterStack/Database/writerInstance", "children": { "Resource": { "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Database/writerInstance/Resource", + "path": "EnhancedMonitoringClusterStack/Database/writerInstance/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::RDS::DBInstance", "aws:cdk:cloudformation:props": { @@ -1017,7 +1017,7 @@ }, "BootstrapVersion": { "id": "BootstrapVersion", - "path": "EnhancedMonitoringClusterTestStack/BootstrapVersion", + "path": "EnhancedMonitoringClusterStack/BootstrapVersion", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" @@ -1025,7 +1025,7 @@ }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", - "path": "EnhancedMonitoringClusterTestStack/CheckBootstrapVersion", + "path": "EnhancedMonitoringClusterStack/CheckBootstrapVersion", "constructInfo": { "fqn": "constructs.Construct", "version": "10.4.2" diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.ts index 6039888fcd8bc..7c1d3d0e748ea 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.ts @@ -5,14 +5,15 @@ import * as rds from 'aws-cdk-lib/aws-rds'; const app = new cdk.App(); -const stack = new cdk.Stack(app, 'EnhancedMonitoringClusterTestStack'); +const stack = new cdk.Stack(app, 'EnhancedMonitoringClusterStack'); const vpc = new ec2.Vpc(stack, 'Vpc'); new rds.DatabaseCluster(stack, 'Database', { engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_16_1 }), writer: rds.ClusterInstance.serverlessV2('writerInstance'), vpc, - monitoringIntervalForCluster: cdk.Duration.seconds(5), + monitoringInterval: cdk.Duration.seconds(5), + enableClusterLevelEnhancedMonitoring: true, }); new IntegTest(app, 'EnhancedMonitoringClusterInteg', { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json new file mode 100644 index 0000000000000..b4c032e30b311 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json similarity index 87% rename from packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json index 756e653b2740d..89056e91da7a7 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json @@ -14,7 +14,7 @@ } } }, - "fa291794217dc1905a6ad35ccdccfb5bcb931a0760adebd6704ba704c700aa3d": { + "d013416bf2dd28dd7ad4549beab97d275f56304997fa8c3f4b9371f4999071cf": { "source": { "path": "EnhancedMonitoringClusterTestStack.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "fa291794217dc1905a6ad35ccdccfb5bcb931a0760adebd6704ba704c700aa3d.json", + "objectKey": "d013416bf2dd28dd7ad4549beab97d275f56304997fa8c3f4b9371f4999071cf.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.template.json similarity index 98% rename from packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.template.json index 18b11dbcc2c8c..d8cfd4b34dcf2 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-enhanced-monitoring.js.snapshot/EnhancedMonitoringClusterTestStack.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.template.json @@ -545,7 +545,7 @@ } } }, - "DatabaseMonitoringRoleForCluster91F5067E": { + "DatabaseMonitoringRole576991DA": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -649,7 +649,7 @@ "MonitoringInterval": 5, "MonitoringRoleArn": { "Fn::GetAtt": [ - "DatabaseMonitoringRoleForCluster91F5067E", + "DatabaseMonitoringRole576991DA", "Arn" ] }, @@ -678,6 +678,13 @@ }, "DBInstanceClass": "db.serverless", "Engine": "aurora-postgresql", + "MonitoringInterval": 5, + "MonitoringRoleArn": { + "Fn::GetAtt": [ + "DatabaseMonitoringRole576991DA", + "Arn" + ] + }, "PromotionTier": 0 }, "DependsOn": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/__entrypoint__.js new file mode 100644 index 0000000000000..ff3a517fba12d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/__entrypoint__.js @@ -0,0 +1,155 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.external = void 0; +exports.handler = handler; +exports.withRetries = withRetries; +const https = require("https"); +const url = require("url"); +// for unit tests +exports.external = { + sendHttpRequest: defaultSendHttpRequest, + log: defaultLog, + includeStackTraces: true, + userHandlerIndex: './index', +}; +const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; +const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; +async function handler(event, context) { + const sanitizedEvent = { ...event, ResponseURL: '...' }; + exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); + // ignore DELETE event when the physical resource ID is the marker that + // indicates that this DELETE is a subsequent DELETE to a failed CREATE + // operation. + if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { + exports.external.log('ignoring DELETE event caused by a failed CREATE event'); + await submitResponse('SUCCESS', event); + return; + } + try { + // invoke the user handler. this is intentionally inside the try-catch to + // ensure that if there is an error it's reported as a failure to + // cloudformation (otherwise cfn waits). + // eslint-disable-next-line @typescript-eslint/no-require-imports + const userHandler = require(exports.external.userHandlerIndex).handler; + const result = await userHandler(sanitizedEvent, context); + // validate user response and create the combined event + const responseEvent = renderResponse(event, result); + // submit to cfn as success + await submitResponse('SUCCESS', responseEvent); + } + catch (e) { + const resp = { + ...event, + Reason: exports.external.includeStackTraces ? e.stack : e.message, + }; + if (!resp.PhysicalResourceId) { + // special case: if CREATE fails, which usually implies, we usually don't + // have a physical resource id. in this case, the subsequent DELETE + // operation does not have any meaning, and will likely fail as well. to + // address this, we use a marker so the provider framework can simply + // ignore the subsequent DELETE. + if (event.RequestType === 'Create') { + exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); + resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; + } + else { + // otherwise, if PhysicalResourceId is not specified, something is + // terribly wrong because all other events should have an ID. + exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); + } + } + // this is an actual error, fail the activity altogether and exist. + await submitResponse('FAILED', resp); + } +} +function renderResponse(cfnRequest, handlerResponse = {}) { + // if physical ID is not returned, we have some defaults for you based + // on the request type. + const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; + // if we are in DELETE and physical ID was changed, it's an error. + if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { + throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); + } + // merge request event and result event (result prevails). + return { + ...cfnRequest, + ...handlerResponse, + PhysicalResourceId: physicalResourceId, + }; +} +async function submitResponse(status, event) { + const json = { + Status: status, + Reason: event.Reason ?? status, + StackId: event.StackId, + RequestId: event.RequestId, + PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, + LogicalResourceId: event.LogicalResourceId, + NoEcho: event.NoEcho, + Data: event.Data, + }; + const parsedUrl = url.parse(event.ResponseURL); + const loggingSafeUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}/${parsedUrl.pathname}?***`; + exports.external.log('submit response to cloudformation', loggingSafeUrl, json); + const responseBody = JSON.stringify(json); + const req = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { + 'content-type': '', + 'content-length': Buffer.byteLength(responseBody, 'utf8'), + }, + }; + const retryOptions = { + attempts: 5, + sleep: 1000, + }; + await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); +} +async function defaultSendHttpRequest(options, requestBody) { + return new Promise((resolve, reject) => { + try { + const request = https.request(options, (response) => { + response.resume(); // Consume the response but don't care about it + if (!response.statusCode || response.statusCode >= 400) { + reject(new Error(`Unsuccessful HTTP response: ${response.statusCode}`)); + } + else { + resolve(); + } + }); + request.on('error', reject); + request.write(requestBody); + request.end(); + } + catch (e) { + reject(e); + } + }); +} +function defaultLog(fmt, ...params) { + // eslint-disable-next-line no-console + console.log(fmt, ...params); +} +function withRetries(options, fn) { + return async (...xs) => { + let attempts = options.attempts; + let ms = options.sleep; + while (true) { + try { + return await fn(...xs); + } + catch (e) { + if (attempts-- <= 0) { + throw e; + } + await sleep(Math.floor(Math.random() * ms)); + ms *= 2; + } + } + }; +} +async function sleep(ms) { + return new Promise((ok) => setTimeout(ok, ms)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/index.js new file mode 100644 index 0000000000000..013bcaffd8fe5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/index.js @@ -0,0 +1 @@ +"use strict";var I=Object.create;var t=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var G=(r,e)=>{for(var o in e)t(r,o,{get:e[o],enumerable:!0})},n=(r,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of P(e))!l.call(r,s)&&s!==o&&t(r,s,{get:()=>e[s],enumerable:!(i=y(e,s))||i.enumerable});return r};var R=(r,e,o)=>(o=r!=null?I(g(r)):{},n(e||!r||!r.__esModule?t(o,"default",{value:r,enumerable:!0}):o,r)),S=r=>n(t({},"__esModule",{value:!0}),r);var k={};G(k,{handler:()=>f});module.exports=S(k);var a=R(require("@aws-sdk/client-ec2")),u=new a.EC2({});function c(r,e){return{GroupId:r,IpPermissions:[{UserIdGroupPairs:[{GroupId:r,UserId:e}],IpProtocol:"-1"}]}}function d(r){return{GroupId:r,IpPermissions:[{IpRanges:[{CidrIp:"0.0.0.0/0"}],IpProtocol:"-1"}]}}async function f(r){let e=r.ResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.Account;switch(r.RequestType){case"Create":return p(e,o);case"Update":return h(r);case"Delete":return m(e,o)}}async function h(r){let e=r.OldResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.DefaultSecurityGroupId;e!==o&&(await m(e,r.ResourceProperties.Account),await p(o,r.ResourceProperties.Account))}async function p(r,e){try{await u.revokeSecurityGroupEgress(d(r))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}try{await u.revokeSecurityGroupIngress(c(r,e))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}}async function m(r,e){await u.authorizeSecurityGroupIngress(c(r,e)),await u.authorizeSecurityGroupEgress(d(r))}0&&(module.exports={handler}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/cdk.out new file mode 100644 index 0000000000000..c6e612584e352 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/integ.json new file mode 100644 index 0000000000000..bc672af16446a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "EnhancedMonitoringClusterInteg/DefaultTest": { + "stacks": [ + "EnhancedMonitoringClusterTestStack" + ], + "assertionStack": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert", + "assertionStackName": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/manifest.json new file mode 100644 index 0000000000000..4bfbfef78e299 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/manifest.json @@ -0,0 +1,319 @@ +{ + "version": "38.0.1", + "artifacts": { + "EnhancedMonitoringClusterTestStack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "EnhancedMonitoringClusterTestStack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "EnhancedMonitoringClusterTestStack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "EnhancedMonitoringClusterTestStack.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d013416bf2dd28dd7ad4549beab97d275f56304997fa8c3f4b9371f4999071cf.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "EnhancedMonitoringClusterTestStack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "EnhancedMonitoringClusterTestStack.assets" + ], + "metadata": { + "/EnhancedMonitoringClusterTestStack/Vpc/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Vpc8378EB38" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1Subnet5C2D37C4" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1RouteTable6C95E38E" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1RouteTableAssociation97140677" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1DefaultRoute3DA9E72A" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1EIPD7E02669" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1NATGateway4D7517AA" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2Subnet691E08A3" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2RouteTable94F7E489" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2RouteTableAssociationDD5762D8" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2DefaultRoute97F91067" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2EIP3C605A87" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2NATGateway9182C01D" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1Subnet536B997A" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1RouteTableB2C5B500" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1RouteTableAssociation70C59FA6" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1DefaultRouteBE02A9ED" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2Subnet3788AAA1" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2RouteTableA678073B" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2RouteTableAssociationA89CAD56" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2DefaultRoute060D2087" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcIGWD7BA715C" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/VPCGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcVPCGWBF912B6E" + } + ], + "/EnhancedMonitoringClusterTestStack/Vpc/RestrictDefaultSecurityGroupCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcRestrictDefaultSecurityGroupCustomResourceC73DA2BE" + } + ], + "/EnhancedMonitoringClusterTestStack/LatestNodeRuntimeMap": [ + { + "type": "aws:cdk:logicalId", + "data": "LatestNodeRuntimeMap" + } + ], + "/EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider": [ + { + "type": "aws:cdk:is-custom-resource-handler-customResourceProvider", + "data": true + } + ], + "/EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" + } + ], + "/EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/Subnets/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabaseSubnets56F17B9A" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabaseSecurityGroup5C91FDCB" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/MonitoringRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabaseMonitoringRole576991DA" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/Secret/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabaseSecret3B817195" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/Secret/Attachment/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabaseSecretAttachmentE5D1B020" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabaseB269D8BB" + } + ], + "/EnhancedMonitoringClusterTestStack/Database/writerInstance/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DatabasewriterInstanceEBFCC003" + } + ], + "/EnhancedMonitoringClusterTestStack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/EnhancedMonitoringClusterTestStack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "EnhancedMonitoringClusterTestStack" + }, + "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets" + ], + "metadata": { + "/EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/tree.json new file mode 100644 index 0000000000000..c2bb7f7fcb410 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/tree.json @@ -0,0 +1,1115 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "EnhancedMonitoringClusterTestStack": { + "id": "EnhancedMonitoringClusterTestStack", + "path": "EnhancedMonitoringClusterTestStack", + "children": { + "Vpc": { + "id": "Vpc", + "path": "EnhancedMonitoringClusterTestStack/Vpc", + "children": { + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Vpc/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPC", + "aws:cdk:cloudformation:props": { + "cidrBlock": "10.0.0.0/16", + "enableDnsHostnames": true, + "enableDnsSupport": true, + "instanceTenancy": "default", + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "PublicSubnet1": { + "id": "PublicSubnet1", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.0.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Acl": { + "id": "Acl", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/Acl", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "subnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "routeTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "EIP": { + "id": "EIP", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "allocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet1EIPD7E02669", + "AllocationId" + ] + }, + "subnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + }, + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "PublicSubnet2": { + "id": "PublicSubnet2", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.64.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Acl": { + "id": "Acl", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/Acl", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + }, + "subnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "routeTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "EIP": { + "id": "EIP", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "allocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet2EIP3C605A87", + "AllocationId" + ] + }, + "subnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + }, + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "PrivateSubnet1": { + "id": "PrivateSubnet1", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.128.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Acl": { + "id": "Acl", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/Acl", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "subnetId": { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VpcPublicSubnet1NATGateway4D7517AA" + }, + "routeTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "PrivateSubnet2": { + "id": "PrivateSubnet2", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.192.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Acl": { + "id": "Acl", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/Acl", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + }, + "subnetId": { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VpcPublicSubnet2NATGateway9182C01D" + }, + "routeTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "IGW": { + "id": "IGW", + "path": "EnhancedMonitoringClusterTestStack/Vpc/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "EnhancedMonitoringClusterTestStack/Vpc" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "VPCGW": { + "id": "VPCGW", + "path": "EnhancedMonitoringClusterTestStack/Vpc/VPCGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "internetGatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "RestrictDefaultSecurityGroupCustomResource": { + "id": "RestrictDefaultSecurityGroupCustomResource", + "path": "EnhancedMonitoringClusterTestStack/Vpc/RestrictDefaultSecurityGroupCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "EnhancedMonitoringClusterTestStack/Vpc/RestrictDefaultSecurityGroupCustomResource/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "LatestNodeRuntimeMap": { + "id": "LatestNodeRuntimeMap", + "path": "EnhancedMonitoringClusterTestStack/LatestNodeRuntimeMap", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Custom::VpcRestrictDefaultSGCustomResourceProvider": { + "id": "Custom::VpcRestrictDefaultSGCustomResourceProvider", + "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider", + "children": { + "Staging": { + "id": "Staging", + "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Role": { + "id": "Role", + "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Handler": { + "id": "Handler", + "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Database": { + "id": "Database", + "path": "EnhancedMonitoringClusterTestStack/Database", + "children": { + "Subnets": { + "id": "Subnets", + "path": "EnhancedMonitoringClusterTestStack/Database/Subnets", + "children": { + "Default": { + "id": "Default", + "path": "EnhancedMonitoringClusterTestStack/Database/Subnets/Default", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::RDS::DBSubnetGroup", + "aws:cdk:cloudformation:props": { + "dbSubnetGroupDescription": "Subnets for Database database", + "subnetIds": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "SecurityGroup": { + "id": "SecurityGroup", + "path": "EnhancedMonitoringClusterTestStack/Database/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Database/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "RDS security group", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup": { + "id": "AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup", + "path": "EnhancedMonitoringClusterTestStack/Database/AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "MonitoringRole": { + "id": "MonitoringRole", + "path": "EnhancedMonitoringClusterTestStack/Database/MonitoringRole", + "children": { + "ImportMonitoringRole": { + "id": "ImportMonitoringRole", + "path": "EnhancedMonitoringClusterTestStack/Database/MonitoringRole/ImportMonitoringRole", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Database/MonitoringRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "monitoring.rds.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Secret": { + "id": "Secret", + "path": "EnhancedMonitoringClusterTestStack/Database/Secret", + "children": { + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Database/Secret/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SecretsManager::Secret", + "aws:cdk:cloudformation:props": { + "description": { + "Fn::Join": [ + "", + [ + "Generated by the CDK for stack: ", + { + "Ref": "AWS::StackName" + } + ] + ] + }, + "generateSecretString": { + "passwordLength": 30, + "secretStringTemplate": "{\"username\":\"postgres\"}", + "generateStringKey": "password", + "excludeCharacters": " %+~`#$&*()|[]{}:;<>?!'/@\"\\" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Attachment": { + "id": "Attachment", + "path": "EnhancedMonitoringClusterTestStack/Database/Secret/Attachment", + "children": { + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Database/Secret/Attachment/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SecretsManager::SecretTargetAttachment", + "aws:cdk:cloudformation:props": { + "secretId": { + "Ref": "DatabaseSecret3B817195" + }, + "targetId": { + "Ref": "DatabaseB269D8BB" + }, + "targetType": "AWS::RDS::DBCluster" + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Database/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::RDS::DBCluster", + "aws:cdk:cloudformation:props": { + "copyTagsToSnapshot": true, + "dbClusterParameterGroupName": "default.aurora-postgresql16", + "dbSubnetGroupName": { + "Ref": "DatabaseSubnets56F17B9A" + }, + "engine": "aurora-postgresql", + "engineVersion": "16.1", + "masterUsername": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "DatabaseSecret3B817195" + }, + ":SecretString:username::}}" + ] + ] + }, + "masterUserPassword": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "DatabaseSecret3B817195" + }, + ":SecretString:password::}}" + ] + ] + }, + "monitoringInterval": 5, + "monitoringRoleArn": { + "Fn::GetAtt": [ + "DatabaseMonitoringRole576991DA", + "Arn" + ] + }, + "port": 5432, + "serverlessV2ScalingConfiguration": { + "minCapacity": 0.5, + "maxCapacity": 2 + }, + "vpcSecurityGroupIds": [ + { + "Fn::GetAtt": [ + "DatabaseSecurityGroup5C91FDCB", + "GroupId" + ] + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "writerInstance": { + "id": "writerInstance", + "path": "EnhancedMonitoringClusterTestStack/Database/writerInstance", + "children": { + "Resource": { + "id": "Resource", + "path": "EnhancedMonitoringClusterTestStack/Database/writerInstance/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::RDS::DBInstance", + "aws:cdk:cloudformation:props": { + "dbClusterIdentifier": { + "Ref": "DatabaseB269D8BB" + }, + "dbInstanceClass": "db.serverless", + "engine": "aurora-postgresql", + "monitoringInterval": 5, + "monitoringRoleArn": { + "Fn::GetAtt": [ + "DatabaseMonitoringRole576991DA", + "Arn" + ] + }, + "promotionTier": 0 + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "EnhancedMonitoringClusterTestStack/BootstrapVersion", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "EnhancedMonitoringClusterTestStack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "EnhancedMonitoringClusterInteg": { + "id": "EnhancedMonitoringClusterInteg", + "path": "EnhancedMonitoringClusterInteg", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "EnhancedMonitoringClusterInteg/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "EnhancedMonitoringClusterInteg/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts index 9cba7d6b6ceb4..b97b760a9747f 100644 --- a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts @@ -249,19 +249,14 @@ interface DatabaseClusterBaseProps { readonly monitoringRole?: IRole; /** - * The interval between points when Amazon RDS collects enhanced - * monitoring metrics for the DB instances. + * Whether to enable enhanced monitoring at the cluster level. * - * @default - no enhanced monitoring - */ - readonly monitoringIntervalForCluster?: Duration; - - /** - * Role that will be used to manage DB instances monitoring. + * If set to true, `monitoringInterval` and `monitoringRole` are applied to not the instances, but the cluster. + * `monitoringInterval` is required to be set if `enableClusterLevelEnhancedMonitoring` is set to true. * - * @default - A role is automatically created for you + * @default - When the `monitoringInterval` is set, enhanced monitoring is enabled for each instance. */ - readonly monitoringRoleForCluster?: IRole; + readonly enableClusterLevelEnhancedMonitoring?: boolean; /** * Role that will be associated with this DB cluster to enable S3 import. @@ -662,6 +657,7 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { protected hasServerlessInstance?: boolean; protected enableDataApi?: boolean; + protected readonly monitoringRole?: iam.IRole; constructor(scope: Construct, id: string, props: DatabaseClusterBaseProps) { super(scope, id); @@ -773,10 +769,10 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { : undefined; this.performanceInsightEncryptionKey = props.performanceInsightEncryptionKey; - // configure enhanced monitoring role for the cluster - let monitoringRoleForCluster = props.monitoringRoleForCluster; - if (!props.monitoringRoleForCluster && props.monitoringIntervalForCluster && props.monitoringIntervalForCluster.toSeconds()) { - monitoringRoleForCluster = new Role(this, 'MonitoringRoleForCluster', { + // configure enhanced monitoring role for the cluster or instance + this.monitoringRole = props.monitoringRole; + if (!props.monitoringRole && props.monitoringInterval && props.monitoringInterval.toSeconds()) { + this.monitoringRole = new Role(this, 'MonitoringRole', { assumedBy: new ServicePrincipal('monitoring.rds.amazonaws.com'), managedPolicies: [ ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole'), @@ -829,8 +825,8 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { performanceInsightsKmsKeyId: this.performanceInsightEncryptionKey?.keyArn, performanceInsightsRetentionPeriod: this.performanceInsightRetention, autoMinorVersionUpgrade: props.autoMinorVersionUpgrade, - monitoringInterval: props.monitoringIntervalForCluster?.toSeconds(), - monitoringRoleArn: monitoringRoleForCluster?.roleArn, + monitoringInterval: props.enableClusterLevelEnhancedMonitoring ? props.monitoringInterval?.toSeconds() : undefined, + monitoringRoleArn: props.enableClusterLevelEnhancedMonitoring ? this.monitoringRole?.roleArn : undefined, }; } @@ -839,25 +835,15 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { * * @internal */ - protected _createInstances(cluster: DatabaseClusterNew, props: DatabaseClusterProps): InstanceConfig { + protected _createInstances(props: DatabaseClusterProps): InstanceConfig { const instanceEndpoints: Endpoint[] = []; const instanceIdentifiers: string[] = []; const readers: IAuroraClusterInstance[] = []; - let monitoringRole = props.monitoringRole; - if (!props.monitoringRole && props.monitoringInterval && props.monitoringInterval.toSeconds()) { - monitoringRole = new Role(cluster, 'MonitoringRole', { - assumedBy: new ServicePrincipal('monitoring.rds.amazonaws.com'), - managedPolicies: [ - ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole'), - ], - }); - } - // need to create the writer first since writer is determined by what instance is first const writer = props.writer!.bind(this, this, { - monitoringInterval: props.monitoringInterval, - monitoringRole: monitoringRole, + monitoringInterval: props.enableClusterLevelEnhancedMonitoring ? undefined : props.monitoringInterval, + monitoringRole: props.enableClusterLevelEnhancedMonitoring ? undefined : this.monitoringRole, removalPolicy: props.removalPolicy ?? RemovalPolicy.SNAPSHOT, subnetGroup: this.subnetGroup, promotionTier: 0, // override the promotion tier so that writers are always 0 @@ -867,8 +853,8 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { (props.readers ?? []).forEach(instance => { const clusterInstance = instance.bind(this, this, { - monitoringInterval: props.monitoringInterval, - monitoringRole: monitoringRole, + monitoringInterval: props.enableClusterLevelEnhancedMonitoring ? undefined : props.monitoringInterval, + monitoringRole: props.enableClusterLevelEnhancedMonitoring ? undefined : this.monitoringRole, removalPolicy: props.removalPolicy ?? RemovalPolicy.SNAPSHOT, subnetGroup: this.subnetGroup, }); @@ -1235,7 +1221,7 @@ export class DatabaseCluster extends DatabaseClusterNew { throw new Error('writer must be provided'); } - const createdInstances = props.writer ? this._createInstances(this, props) : legacyCreateInstances(this, props, this.subnetGroup); + const createdInstances = props.writer ? this._createInstances(props) : legacyCreateInstances(this, props, this.subnetGroup); this.instanceIdentifiers = createdInstances.instanceIdentifiers; this.instanceEndpoints = createdInstances.instanceEndpoints; } @@ -1421,7 +1407,7 @@ export class DatabaseClusterFromSnapshot extends DatabaseClusterNew { if ((props.writer || props.readers) && (props.instances || props.instanceProps)) { throw new Error('Cannot provide clusterInstances if instances or instanceProps are provided'); } - const createdInstances = props.writer ? this._createInstances(this, props) : legacyCreateInstances(this, props, this.subnetGroup); + const createdInstances = props.writer ? this._createInstances(props) : legacyCreateInstances(this, props, this.subnetGroup); this.instanceIdentifiers = createdInstances.instanceIdentifiers; this.instanceEndpoints = createdInstances.instanceEndpoints; } From c02d3405c0311d86285ef7c698728e1fc8ce4ea0 Mon Sep 17 00:00:00 2001 From: Kazuho CryerShinozuka Date: Sat, 16 Nov 2024 21:39:32 +0900 Subject: [PATCH 03/11] add validation --- packages/aws-cdk-lib/aws-rds/lib/cluster.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts index b97b760a9747f..faaaa4c7ba182 100644 --- a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts @@ -234,15 +234,20 @@ interface DatabaseClusterBaseProps { readonly cloudwatchLogsRetentionRole?: IRole; /** - * The interval between points when Amazon RDS collects enhanced - * monitoring metrics for the DB instances. + * The interval between points when Amazon RDS collects enhanced monitoring metrics. + * + * If you enable `enableClusterLevelEnhancedMonitoring`, this property is applied to the cluster, + * otherwise it is applied to the instances. * * @default - no enhanced monitoring */ readonly monitoringInterval?: Duration; /** - * Role that will be used to manage DB instances monitoring. + * Role that will be used to manage DB monitoring. + * + * If you enable `enableClusterLevelEnhancedMonitoring`, this property is applied to the cluster, + * otherwise it is applied to the instances. * * @default - A role is automatically created for you */ @@ -780,6 +785,13 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { }); } + if (props.enableClusterLevelEnhancedMonitoring && !props.monitoringInterval) { + throw new Error('`monitoringInterval` must be set when `enableClusterLevelEnhancedMonitoring` is true.'); + } + if (props.monitoringInterval && [0, 1, 5, 10, 15, 30, 60].indexOf(props.monitoringInterval.toSeconds()) === -1) { + throw new Error(`'monitoringInterval' must be one of 0, 1, 5, 10, 15, 30, or 60 seconds, got: ${props.monitoringInterval.toSeconds()} seconds.`); + } + this.newCfnProps = { // Basic engine: props.engine.engineType, From 1d1b8a85738983431a493439c9b4476fd82287b4 Mon Sep 17 00:00:00 2001 From: Kazuho CryerShinozuka Date: Sat, 16 Nov 2024 21:57:25 +0900 Subject: [PATCH 04/11] update readme --- packages/aws-cdk-lib/aws-rds/README.md | 45 +++++++++++++++++++++ packages/aws-cdk-lib/aws-rds/lib/cluster.ts | 4 +- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/packages/aws-cdk-lib/aws-rds/README.md b/packages/aws-cdk-lib/aws-rds/README.md index 3cb3afc681fd1..917d86ae3992b 100644 --- a/packages/aws-cdk-lib/aws-rds/README.md +++ b/packages/aws-cdk-lib/aws-rds/README.md @@ -1372,3 +1372,48 @@ To see Amazon RDS DB engines that support Performance Insights, see [Amazon RDS To see Amazon Aurora DB engines that support Performance Insights, see [Amazon Aurora DB engine, Region, and instance class support for Performance Insights](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.Overview.Engines.html). For more information about Performance Insights, see [Monitoring DB load with Performance Insights on Amazon RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html). + +## Enhanced Monitoring + +With [Enhanced Monitoring](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.OS.html#USER_Monitoring.OS.Enabling), you can monitor the operating system of your DB instance in real time. + +To enable Enhanced Monitoring for a clustered database, set the `monitoringInterval` property. +This value is applied to all instances in the cluster by default. + +If you want to enable enhanced monitoring at the cluster level, you can set the `enableClusterLevelEnhancedMonitoring` property to `true`. + +```ts +declare const vpc: ec2.Vpc; +// Enable Enhanced Monitoring for all of the instances in the cluster +new rds.DatabaseCluster(this, 'Cluster', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_39 }), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R7G, ec2.InstanceSize.LARGE), + vpc, + monitoringInterval: Duration.seconds(5), +}); + +// Enable Enhanced Monitoring at the cluster level +new rds.DatabaseCluster(this, 'Cluster', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_39 }), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R7G, ec2.InstanceSize.LARGE), + vpc, + monitoringInterval: Duration.seconds(5), + enableClusterLevelEnhancedMonitoring: true, +}); +``` + +AWS CDK automatically generate the IAM role for Enhanced Monitoring. +If you want to create the IAM role manually, you can use the `monitoringRole` property. + +```ts +declare const vpc: ec2.Vpc; +declare const monitoringRole: iam.Role; + +new rds.DatabaseCluster(this, 'Cluster', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_39 }), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R7G, ec2.InstanceSize.LARGE), + vpc, + monitoringInterval: Duration.seconds(5), + monitoringRole, +}); +``` diff --git a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts index faaaa4c7ba182..d8a4d55f4fea2 100644 --- a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts @@ -51,7 +51,7 @@ interface DatabaseClusterBaseProps { /** * The instance to use for the cluster writer * - * @default required if instanceProps is not provided + * @default - required if instanceProps is not provided */ readonly writer?: IClusterInstance; @@ -102,7 +102,7 @@ interface DatabaseClusterBaseProps { /** * Security group. * - * @default a new security group is created. + * @default - a new security group is created. */ readonly securityGroups?: ec2.ISecurityGroup[]; From 26f48293785806e5cb8df359c9d46c0712208226 Mon Sep 17 00:00:00 2001 From: Kazuho CryerShinozuka Date: Sat, 16 Nov 2024 22:55:33 +0900 Subject: [PATCH 05/11] update unit test --- packages/aws-cdk-lib/aws-rds/lib/cluster.ts | 20 +- .../aws-cdk-lib/aws-rds/test/cluster.test.ts | 387 ++++++++++++------ 2 files changed, 279 insertions(+), 128 deletions(-) diff --git a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts index d8a4d55f4fea2..34e90c9ae6dfc 100644 --- a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts @@ -657,12 +657,16 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { */ public readonly performanceInsightEncryptionKey?: kms.IKey; + /** + * The IAM role for the enhanced monitoring. + */ + public readonly monitoringRole?: iam.IRole; + protected readonly serverlessV2MinCapacity: number; protected readonly serverlessV2MaxCapacity: number; protected hasServerlessInstance?: boolean; protected enableDataApi?: boolean; - protected readonly monitoringRole?: iam.IRole; constructor(scope: Construct, id: string, props: DatabaseClusterBaseProps) { super(scope, id); @@ -1479,16 +1483,6 @@ function legacyCreateInstances(cluster: DatabaseClusterNew, props: DatabaseClust // Get the actual subnet objects so we can depend on internet connectivity. const internetConnected = instanceProps.vpc.selectSubnets(instanceProps.vpcSubnets).internetConnectivityEstablished; - let monitoringRole; - if (props.monitoringInterval && props.monitoringInterval.toSeconds()) { - monitoringRole = props.monitoringRole || new Role(cluster, 'MonitoringRole', { - assumedBy: new ServicePrincipal('monitoring.rds.amazonaws.com'), - managedPolicies: [ - ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole'), - ], - }); - } - const enablePerformanceInsights = instanceProps.enablePerformanceInsights || instanceProps.performanceInsightRetention !== undefined || instanceProps.performanceInsightEncryptionKey !== undefined; if (enablePerformanceInsights && instanceProps.enablePerformanceInsights === false) { @@ -1545,8 +1539,8 @@ function legacyCreateInstances(cluster: DatabaseClusterNew, props: DatabaseClust // This is already set on the Cluster. Unclear to me whether it should be repeated or not. Better yes. dbSubnetGroupName: subnetGroup.subnetGroupName, dbParameterGroupName: instanceParameterGroupConfig?.parameterGroupName, - monitoringInterval: props.monitoringInterval && props.monitoringInterval.toSeconds(), - monitoringRoleArn: monitoringRole && monitoringRole.roleArn, + monitoringInterval: props.enableClusterLevelEnhancedMonitoring ? undefined : props.monitoringInterval?.toSeconds(), + monitoringRoleArn: props.enableClusterLevelEnhancedMonitoring ? undefined : cluster.monitoringRole?.roleArn, autoMinorVersionUpgrade: instanceProps.autoMinorVersionUpgrade, allowMajorVersionUpgrade: instanceProps.allowMajorVersionUpgrade, deleteAutomatedBackups: instanceProps.deleteAutomatedBackups, diff --git a/packages/aws-cdk-lib/aws-rds/test/cluster.test.ts b/packages/aws-cdk-lib/aws-rds/test/cluster.test.ts index b9018199b1376..57ff4cd3844d9 100644 --- a/packages/aws-cdk-lib/aws-rds/test/cluster.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/cluster.test.ts @@ -2487,148 +2487,305 @@ describe('cluster', () => { }); }); - test('cluster with enabled monitoring (legacy)', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); + describe('enhanced monitoring', () => { + test('cluster with enabled monitoring (legacy)', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - monitoringInterval: cdk.Duration.minutes(1), - }); + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + monitoringInterval: cdk.Duration.minutes(1), + }); - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - MonitoringInterval: 60, - MonitoringRoleArn: { - 'Fn::GetAtt': ['DatabaseMonitoringRole576991DA', 'Arn'], - }, - }); + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + MonitoringInterval: 60, + MonitoringRoleArn: { + 'Fn::GetAtt': ['DatabaseMonitoringRole576991DA', 'Arn'], + }, + }); - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'monitoring.rds.amazonaws.com', + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'monitoring.rds.amazonaws.com', + }, }, + ], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole', + ], + ], }, ], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', + }); + }); + + test('cluster with enabled monitoring should create default role with new api', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + vpc, + writer: ClusterInstance.serverlessV2('writer'), + iamAuthentication: true, + monitoringInterval: cdk.Duration.minutes(1), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + MonitoringInterval: 60, + MonitoringRoleArn: { + 'Fn::GetAtt': ['DatabaseMonitoringRole576991DA', 'Arn'], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'monitoring.rds.amazonaws.com', }, - ':iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole', - ], + }, ], + Version: '2012-10-17', }, - ], + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole', + ], + ], + }, + ], + }); }); - }); - test('cluster with enabled monitoring should create default role with new api', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); + test('create a cluster with imported monitoring role', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - vpc, - writer: ClusterInstance.serverlessV2('writer'), - iamAuthentication: true, - monitoringInterval: cdk.Duration.minutes(1), - }); + const monitoringRole = new Role(stack, 'MonitoringRole', { + assumedBy: new ServicePrincipal('monitoring.rds.amazonaws.com'), + managedPolicies: [ + ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole'), + ], + }); - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - MonitoringInterval: 60, - MonitoringRoleArn: { - 'Fn::GetAtt': ['DatabaseMonitoringRole576991DA', 'Arn'], - }, + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + monitoringInterval: cdk.Duration.minutes(1), + monitoringRole, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + MonitoringInterval: 60, + MonitoringRoleArn: { + 'Fn::GetAtt': ['MonitoringRole90457BF9', 'Arn'], + }, + }); }); - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'monitoring.rds.amazonaws.com', + test('enable enhanced monitoring at the cluster level', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.auroraMysql({ version: AuroraMysqlEngineVersion.VER_3_07_1 }), + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + vpc, + writer: ClusterInstance.serverlessV2('writer'), + monitoringInterval: cdk.Duration.minutes(1), + enableClusterLevelEnhancedMonitoring: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + MonitoringInterval: 60, + MonitoringRoleArn: { + 'Fn::GetAtt': ['DatabaseMonitoringRole576991DA', 'Arn'], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'monitoring.rds.amazonaws.com', + }, }, + ], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole', + ], + ], }, ], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', + }); + }); + + test('enable enhanced monitoring at the cluster level (legacy)', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + monitoringInterval: cdk.Duration.minutes(1), + enableClusterLevelEnhancedMonitoring: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + MonitoringInterval: 60, + MonitoringRoleArn: { + 'Fn::GetAtt': ['DatabaseMonitoringRole576991DA', 'Arn'], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'monitoring.rds.amazonaws.com', }, - ':iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole', - ], + }, ], + Version: '2012-10-17', }, - ], + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole', + ], + ], + }, + ], + }); }); - }); - test('create a cluster with imported monitoring role', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); + test('throw error for not setting monitoring interval when enabling enhanced monitoring at the cluster level', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); - const monitoringRole = new Role(stack, 'MonitoringRole', { - assumedBy: new ServicePrincipal('monitoring.rds.amazonaws.com'), - managedPolicies: [ - ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole'), - ], + expect(() => { + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.auroraMysql({ version: AuroraMysqlEngineVersion.VER_3_07_1 }), + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + vpc, + writer: ClusterInstance.serverlessV2('writer'), + enableClusterLevelEnhancedMonitoring: true, + }); + }).toThrow('`monitoringInterval` must be set when `enableClusterLevelEnhancedMonitoring` is true.'); }); - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - monitoringInterval: cdk.Duration.minutes(1), - monitoringRole, - }); + test.each([ + cdk.Duration.seconds(2), + cdk.Duration.minutes(2), + ])('throw error for invalid monitoring interval %s', (monitoringInterval) => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - MonitoringInterval: 60, - MonitoringRoleArn: { - 'Fn::GetAtt': ['MonitoringRole90457BF9', 'Arn'], - }, + expect(() => { + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.auroraMysql({ version: AuroraMysqlEngineVersion.VER_3_07_1 }), + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + vpc, + writer: ClusterInstance.serverlessV2('writer'), + monitoringInterval, + }); + }).toThrow(`'monitoringInterval' must be one of 0, 1, 5, 10, 15, 30, or 60 seconds, got: ${monitoringInterval.toSeconds()} seconds.`); }); }); From 828ddf7394ca513461df3deac518ab1ecb5a6a34 Mon Sep 17 00:00:00 2001 From: Kazuho CryerShinozuka Date: Sun, 17 Nov 2024 21:26:37 +0900 Subject: [PATCH 06/11] update readme --- packages/aws-cdk-lib/aws-rds/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/aws-cdk-lib/aws-rds/README.md b/packages/aws-cdk-lib/aws-rds/README.md index 917d86ae3992b..6d64f2bd3b37b 100644 --- a/packages/aws-cdk-lib/aws-rds/README.md +++ b/packages/aws-cdk-lib/aws-rds/README.md @@ -1386,16 +1386,16 @@ If you want to enable enhanced monitoring at the cluster level, you can set the declare const vpc: ec2.Vpc; // Enable Enhanced Monitoring for all of the instances in the cluster new rds.DatabaseCluster(this, 'Cluster', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_39 }), - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R7G, ec2.InstanceSize.LARGE), + engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_16_1 }),, + writer: rds.ClusterInstance.serverlessV2('writerInstance'), vpc, monitoringInterval: Duration.seconds(5), }); // Enable Enhanced Monitoring at the cluster level new rds.DatabaseCluster(this, 'Cluster', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_39 }), - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R7G, ec2.InstanceSize.LARGE), + engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_16_1 }),, + writer: rds.ClusterInstance.serverlessV2('writerInstance'), vpc, monitoringInterval: Duration.seconds(5), enableClusterLevelEnhancedMonitoring: true, @@ -1410,8 +1410,8 @@ declare const vpc: ec2.Vpc; declare const monitoringRole: iam.Role; new rds.DatabaseCluster(this, 'Cluster', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_39 }), - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R7G, ec2.InstanceSize.LARGE), + engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_16_1 }),, + writer: rds.ClusterInstance.serverlessV2('writerInstance'), vpc, monitoringInterval: Duration.seconds(5), monitoringRole, From be282da95214f904f0822f8ae108af82428af5bf Mon Sep 17 00:00:00 2001 From: Kazuho CryerShinozuka Date: Sun, 17 Nov 2024 22:14:55 +0900 Subject: [PATCH 07/11] update readme --- packages/aws-cdk-lib/aws-rds/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/aws-cdk-lib/aws-rds/README.md b/packages/aws-cdk-lib/aws-rds/README.md index 6d64f2bd3b37b..12f1ecb4bd666 100644 --- a/packages/aws-cdk-lib/aws-rds/README.md +++ b/packages/aws-cdk-lib/aws-rds/README.md @@ -1386,7 +1386,7 @@ If you want to enable enhanced monitoring at the cluster level, you can set the declare const vpc: ec2.Vpc; // Enable Enhanced Monitoring for all of the instances in the cluster new rds.DatabaseCluster(this, 'Cluster', { - engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_16_1 }),, + engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_16_1 }), writer: rds.ClusterInstance.serverlessV2('writerInstance'), vpc, monitoringInterval: Duration.seconds(5), @@ -1394,7 +1394,7 @@ new rds.DatabaseCluster(this, 'Cluster', { // Enable Enhanced Monitoring at the cluster level new rds.DatabaseCluster(this, 'Cluster', { - engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_16_1 }),, + engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_16_1 }), writer: rds.ClusterInstance.serverlessV2('writerInstance'), vpc, monitoringInterval: Duration.seconds(5), From c974f6f209c6f41bfed3b26920409fcc667e8adb Mon Sep 17 00:00:00 2001 From: Kazuho CryerShinozuka Date: Sun, 17 Nov 2024 23:12:41 +0900 Subject: [PATCH 08/11] update readme --- packages/aws-cdk-lib/aws-rds/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-rds/README.md b/packages/aws-cdk-lib/aws-rds/README.md index 12f1ecb4bd666..649c48e4ae432 100644 --- a/packages/aws-cdk-lib/aws-rds/README.md +++ b/packages/aws-cdk-lib/aws-rds/README.md @@ -1410,7 +1410,7 @@ declare const vpc: ec2.Vpc; declare const monitoringRole: iam.Role; new rds.DatabaseCluster(this, 'Cluster', { - engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_16_1 }),, + engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_16_1 }), writer: rds.ClusterInstance.serverlessV2('writerInstance'), vpc, monitoringInterval: Duration.seconds(5), From ce187c6285c25774c1b996dfb6e3db2ddbc8ded8 Mon Sep 17 00:00:00 2001 From: Kazuho Cryer-Shinozuka Date: Fri, 22 Nov 2024 11:22:38 +0900 Subject: [PATCH 09/11] Update packages/aws-cdk-lib/aws-rds/README.md Co-authored-by: GZ --- packages/aws-cdk-lib/aws-rds/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-rds/README.md b/packages/aws-cdk-lib/aws-rds/README.md index 649c48e4ae432..c677359283fc2 100644 --- a/packages/aws-cdk-lib/aws-rds/README.md +++ b/packages/aws-cdk-lib/aws-rds/README.md @@ -1378,7 +1378,7 @@ For more information about Performance Insights, see [Monitoring DB load with Pe With [Enhanced Monitoring](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.OS.html#USER_Monitoring.OS.Enabling), you can monitor the operating system of your DB instance in real time. To enable Enhanced Monitoring for a clustered database, set the `monitoringInterval` property. -This value is applied to all instances in the cluster by default. +This value is applied at instance level to all instances in the cluster by default. If you want to enable enhanced monitoring at the cluster level, you can set the `enableClusterLevelEnhancedMonitoring` property to `true`. From f79868f36f3d313a455f0a9f2cf575a953250f92 Mon Sep 17 00:00:00 2001 From: Kazuho Cryer-Shinozuka Date: Fri, 22 Nov 2024 11:22:57 +0900 Subject: [PATCH 10/11] Update packages/aws-cdk-lib/aws-rds/README.md Co-authored-by: GZ --- packages/aws-cdk-lib/aws-rds/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-rds/README.md b/packages/aws-cdk-lib/aws-rds/README.md index c677359283fc2..548465b28a839 100644 --- a/packages/aws-cdk-lib/aws-rds/README.md +++ b/packages/aws-cdk-lib/aws-rds/README.md @@ -1380,7 +1380,7 @@ With [Enhanced Monitoring](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuid To enable Enhanced Monitoring for a clustered database, set the `monitoringInterval` property. This value is applied at instance level to all instances in the cluster by default. -If you want to enable enhanced monitoring at the cluster level, you can set the `enableClusterLevelEnhancedMonitoring` property to `true`. +If you want to enable enhanced monitoring at the cluster level, you can set the `enableClusterLevelEnhancedMonitoring` property to `true`. Note that you must set `monitoringInterval` when using `enableClusterLevelEnhancedMonitoring` ```ts declare const vpc: ec2.Vpc; From 4ab8b76b017eda21770667d3fc65a4a3bb9272d3 Mon Sep 17 00:00:00 2001 From: Kazuho CryerShinozuka Date: Fri, 22 Nov 2024 11:52:50 +0900 Subject: [PATCH 11/11] update --- ...efaultTestDeployAssertBBA17BDD.assets.json | 19 - ...aultTestDeployAssertBBA17BDD.template.json | 36 - ...ncedMonitoringClusterTestStack.assets.json | 32 - ...edMonitoringClusterTestStack.template.json | 858 ------------- .../__entrypoint__.js | 155 --- .../index.js | 1 - .../test/integ.temp.js.snapshot/cdk.out | 1 - .../test/integ.temp.js.snapshot/integ.json | 12 - .../test/integ.temp.js.snapshot/manifest.json | 319 ----- .../test/integ.temp.js.snapshot/tree.json | 1115 ----------------- packages/aws-cdk-lib/aws-rds/README.md | 2 +- packages/aws-cdk-lib/aws-rds/lib/cluster.ts | 6 + 12 files changed, 7 insertions(+), 2549 deletions(-) delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.template.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/__entrypoint__.js delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/index.js delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/cdk.out delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/integ.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/manifest.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json deleted file mode 100644 index b4c032e30b311..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "38.0.1", - "files": { - "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { - "source": { - "path": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json deleted file mode 100644 index ad9d0fb73d1dd..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json deleted file mode 100644 index 89056e91da7a7..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.assets.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "version": "38.0.1", - "files": { - "a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c": { - "source": { - "path": "asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c", - "packaging": "zip" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c.zip", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "d013416bf2dd28dd7ad4549beab97d275f56304997fa8c3f4b9371f4999071cf": { - "source": { - "path": "EnhancedMonitoringClusterTestStack.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "d013416bf2dd28dd7ad4549beab97d275f56304997fa8c3f4b9371f4999071cf.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.template.json deleted file mode 100644 index d8cfd4b34dcf2..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/EnhancedMonitoringClusterTestStack.template.json +++ /dev/null @@ -1,858 +0,0 @@ -{ - "Resources": { - "Vpc8378EB38": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc" - } - ] - } - }, - "VpcPublicSubnet1Subnet5C2D37C4": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.0.0/18", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "VpcPublicSubnet1RouteTable6C95E38E": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "VpcPublicSubnet1RouteTableAssociation97140677": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet1RouteTable6C95E38E" - }, - "SubnetId": { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - } - } - }, - "VpcPublicSubnet1DefaultRoute3DA9E72A": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "VpcIGWD7BA715C" - }, - "RouteTableId": { - "Ref": "VpcPublicSubnet1RouteTable6C95E38E" - } - }, - "DependsOn": [ - "VpcVPCGWBF912B6E" - ] - }, - "VpcPublicSubnet1EIPD7E02669": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" - } - ] - } - }, - "VpcPublicSubnet1NATGateway4D7517AA": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "AllocationId": { - "Fn::GetAtt": [ - "VpcPublicSubnet1EIPD7E02669", - "AllocationId" - ] - }, - "SubnetId": { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - }, - "Tags": [ - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" - } - ] - }, - "DependsOn": [ - "VpcPublicSubnet1DefaultRoute3DA9E72A", - "VpcPublicSubnet1RouteTableAssociation97140677" - ] - }, - "VpcPublicSubnet2Subnet691E08A3": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.64.0/18", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "VpcPublicSubnet2RouteTable94F7E489": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "VpcPublicSubnet2RouteTableAssociationDD5762D8": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet2RouteTable94F7E489" - }, - "SubnetId": { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - } - } - }, - "VpcPublicSubnet2DefaultRoute97F91067": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "VpcIGWD7BA715C" - }, - "RouteTableId": { - "Ref": "VpcPublicSubnet2RouteTable94F7E489" - } - }, - "DependsOn": [ - "VpcVPCGWBF912B6E" - ] - }, - "VpcPublicSubnet2EIP3C605A87": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" - } - ] - } - }, - "VpcPublicSubnet2NATGateway9182C01D": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "AllocationId": { - "Fn::GetAtt": [ - "VpcPublicSubnet2EIP3C605A87", - "AllocationId" - ] - }, - "SubnetId": { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - }, - "Tags": [ - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" - } - ] - }, - "DependsOn": [ - "VpcPublicSubnet2DefaultRoute97F91067", - "VpcPublicSubnet2RouteTableAssociationDD5762D8" - ] - }, - "VpcPrivateSubnet1Subnet536B997A": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.128.0/18", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "VpcPrivateSubnet1RouteTableB2C5B500": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "VpcPrivateSubnet1RouteTableAssociation70C59FA6": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" - }, - "SubnetId": { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - } - } - }, - "VpcPrivateSubnet1DefaultRouteBE02A9ED": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "VpcPublicSubnet1NATGateway4D7517AA" - }, - "RouteTableId": { - "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" - } - } - }, - "VpcPrivateSubnet2Subnet3788AAA1": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.192.0/18", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "VpcPrivateSubnet2RouteTableA678073B": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "VpcPrivateSubnet2RouteTableAssociationA89CAD56": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet2RouteTableA678073B" - }, - "SubnetId": { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - } - }, - "VpcPrivateSubnet2DefaultRoute060D2087": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "VpcPublicSubnet2NATGateway9182C01D" - }, - "RouteTableId": { - "Ref": "VpcPrivateSubnet2RouteTableA678073B" - } - } - }, - "VpcIGWD7BA715C": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "EnhancedMonitoringClusterTestStack/Vpc" - } - ] - } - }, - "VpcVPCGWBF912B6E": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "InternetGatewayId": { - "Ref": "VpcIGWD7BA715C" - }, - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "VpcRestrictDefaultSecurityGroupCustomResourceC73DA2BE": { - "Type": "Custom::VpcRestrictDefaultSG", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E", - "Arn" - ] - }, - "DefaultSecurityGroupId": { - "Fn::GetAtt": [ - "Vpc8378EB38", - "DefaultSecurityGroup" - ] - }, - "Account": { - "Ref": "AWS::AccountId" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ] - }, - "ManagedPolicyArns": [ - { - "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - } - ], - "Policies": [ - { - "PolicyName": "Inline", - "PolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "ec2:AuthorizeSecurityGroupIngress", - "ec2:AuthorizeSecurityGroupEgress", - "ec2:RevokeSecurityGroupIngress", - "ec2:RevokeSecurityGroupEgress" - ], - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":security-group/", - { - "Fn::GetAtt": [ - "Vpc8378EB38", - "DefaultSecurityGroup" - ] - } - ] - ] - } - ] - } - ] - } - } - ] - } - }, - "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - }, - "S3Key": "a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c.zip" - }, - "Timeout": 900, - "MemorySize": 128, - "Handler": "__entrypoint__.handler", - "Role": { - "Fn::GetAtt": [ - "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0", - "Arn" - ] - }, - "Runtime": { - "Fn::FindInMap": [ - "LatestNodeRuntimeMap", - { - "Ref": "AWS::Region" - }, - "value" - ] - }, - "Description": "Lambda function for removing all inbound/outbound rules from the VPC default security group" - }, - "DependsOn": [ - "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" - ] - }, - "DatabaseSubnets56F17B9A": { - "Type": "AWS::RDS::DBSubnetGroup", - "Properties": { - "DBSubnetGroupDescription": "Subnets for Database database", - "SubnetIds": [ - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - }, - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ] - } - }, - "DatabaseSecurityGroup5C91FDCB": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "RDS security group", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "DatabaseMonitoringRole576991DA": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "monitoring.rds.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole" - ] - ] - } - ] - } - }, - "DatabaseSecret3B817195": { - "Type": "AWS::SecretsManager::Secret", - "Properties": { - "Description": { - "Fn::Join": [ - "", - [ - "Generated by the CDK for stack: ", - { - "Ref": "AWS::StackName" - } - ] - ] - }, - "GenerateSecretString": { - "ExcludeCharacters": " %+~`#$&*()|[]{}:;<>?!'/@\"\\", - "GenerateStringKey": "password", - "PasswordLength": 30, - "SecretStringTemplate": "{\"username\":\"postgres\"}" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "DatabaseSecretAttachmentE5D1B020": { - "Type": "AWS::SecretsManager::SecretTargetAttachment", - "Properties": { - "SecretId": { - "Ref": "DatabaseSecret3B817195" - }, - "TargetId": { - "Ref": "DatabaseB269D8BB" - }, - "TargetType": "AWS::RDS::DBCluster" - } - }, - "DatabaseB269D8BB": { - "Type": "AWS::RDS::DBCluster", - "Properties": { - "CopyTagsToSnapshot": true, - "DBClusterParameterGroupName": "default.aurora-postgresql16", - "DBSubnetGroupName": { - "Ref": "DatabaseSubnets56F17B9A" - }, - "Engine": "aurora-postgresql", - "EngineVersion": "16.1", - "MasterUserPassword": { - "Fn::Join": [ - "", - [ - "{{resolve:secretsmanager:", - { - "Ref": "DatabaseSecret3B817195" - }, - ":SecretString:password::}}" - ] - ] - }, - "MasterUsername": { - "Fn::Join": [ - "", - [ - "{{resolve:secretsmanager:", - { - "Ref": "DatabaseSecret3B817195" - }, - ":SecretString:username::}}" - ] - ] - }, - "MonitoringInterval": 5, - "MonitoringRoleArn": { - "Fn::GetAtt": [ - "DatabaseMonitoringRole576991DA", - "Arn" - ] - }, - "Port": 5432, - "ServerlessV2ScalingConfiguration": { - "MaxCapacity": 2, - "MinCapacity": 0.5 - }, - "VpcSecurityGroupIds": [ - { - "Fn::GetAtt": [ - "DatabaseSecurityGroup5C91FDCB", - "GroupId" - ] - } - ] - }, - "UpdateReplacePolicy": "Snapshot", - "DeletionPolicy": "Snapshot" - }, - "DatabasewriterInstanceEBFCC003": { - "Type": "AWS::RDS::DBInstance", - "Properties": { - "DBClusterIdentifier": { - "Ref": "DatabaseB269D8BB" - }, - "DBInstanceClass": "db.serverless", - "Engine": "aurora-postgresql", - "MonitoringInterval": 5, - "MonitoringRoleArn": { - "Fn::GetAtt": [ - "DatabaseMonitoringRole576991DA", - "Arn" - ] - }, - "PromotionTier": 0 - }, - "DependsOn": [ - "VpcPrivateSubnet1DefaultRouteBE02A9ED", - "VpcPrivateSubnet1RouteTableAssociation70C59FA6", - "VpcPrivateSubnet2DefaultRoute060D2087", - "VpcPrivateSubnet2RouteTableAssociationA89CAD56" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - } - }, - "Mappings": { - "LatestNodeRuntimeMap": { - "af-south-1": { - "value": "nodejs20.x" - }, - "ap-east-1": { - "value": "nodejs20.x" - }, - "ap-northeast-1": { - "value": "nodejs20.x" - }, - "ap-northeast-2": { - "value": "nodejs20.x" - }, - "ap-northeast-3": { - "value": "nodejs20.x" - }, - "ap-south-1": { - "value": "nodejs20.x" - }, - "ap-south-2": { - "value": "nodejs20.x" - }, - "ap-southeast-1": { - "value": "nodejs20.x" - }, - "ap-southeast-2": { - "value": "nodejs20.x" - }, - "ap-southeast-3": { - "value": "nodejs20.x" - }, - "ap-southeast-4": { - "value": "nodejs20.x" - }, - "ap-southeast-5": { - "value": "nodejs20.x" - }, - "ap-southeast-7": { - "value": "nodejs20.x" - }, - "ca-central-1": { - "value": "nodejs20.x" - }, - "ca-west-1": { - "value": "nodejs20.x" - }, - "cn-north-1": { - "value": "nodejs18.x" - }, - "cn-northwest-1": { - "value": "nodejs18.x" - }, - "eu-central-1": { - "value": "nodejs20.x" - }, - "eu-central-2": { - "value": "nodejs20.x" - }, - "eu-isoe-west-1": { - "value": "nodejs18.x" - }, - "eu-north-1": { - "value": "nodejs20.x" - }, - "eu-south-1": { - "value": "nodejs20.x" - }, - "eu-south-2": { - "value": "nodejs20.x" - }, - "eu-west-1": { - "value": "nodejs20.x" - }, - "eu-west-2": { - "value": "nodejs20.x" - }, - "eu-west-3": { - "value": "nodejs20.x" - }, - "il-central-1": { - "value": "nodejs20.x" - }, - "me-central-1": { - "value": "nodejs20.x" - }, - "me-south-1": { - "value": "nodejs20.x" - }, - "mx-central-1": { - "value": "nodejs20.x" - }, - "sa-east-1": { - "value": "nodejs20.x" - }, - "us-east-1": { - "value": "nodejs20.x" - }, - "us-east-2": { - "value": "nodejs20.x" - }, - "us-gov-east-1": { - "value": "nodejs18.x" - }, - "us-gov-west-1": { - "value": "nodejs18.x" - }, - "us-iso-east-1": { - "value": "nodejs18.x" - }, - "us-iso-west-1": { - "value": "nodejs18.x" - }, - "us-isob-east-1": { - "value": "nodejs18.x" - }, - "us-west-1": { - "value": "nodejs20.x" - }, - "us-west-2": { - "value": "nodejs20.x" - } - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/__entrypoint__.js deleted file mode 100644 index ff3a517fba12d..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/__entrypoint__.js +++ /dev/null @@ -1,155 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.external = void 0; -exports.handler = handler; -exports.withRetries = withRetries; -const https = require("https"); -const url = require("url"); -// for unit tests -exports.external = { - sendHttpRequest: defaultSendHttpRequest, - log: defaultLog, - includeStackTraces: true, - userHandlerIndex: './index', -}; -const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; -const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; -async function handler(event, context) { - const sanitizedEvent = { ...event, ResponseURL: '...' }; - exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); - // ignore DELETE event when the physical resource ID is the marker that - // indicates that this DELETE is a subsequent DELETE to a failed CREATE - // operation. - if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { - exports.external.log('ignoring DELETE event caused by a failed CREATE event'); - await submitResponse('SUCCESS', event); - return; - } - try { - // invoke the user handler. this is intentionally inside the try-catch to - // ensure that if there is an error it's reported as a failure to - // cloudformation (otherwise cfn waits). - // eslint-disable-next-line @typescript-eslint/no-require-imports - const userHandler = require(exports.external.userHandlerIndex).handler; - const result = await userHandler(sanitizedEvent, context); - // validate user response and create the combined event - const responseEvent = renderResponse(event, result); - // submit to cfn as success - await submitResponse('SUCCESS', responseEvent); - } - catch (e) { - const resp = { - ...event, - Reason: exports.external.includeStackTraces ? e.stack : e.message, - }; - if (!resp.PhysicalResourceId) { - // special case: if CREATE fails, which usually implies, we usually don't - // have a physical resource id. in this case, the subsequent DELETE - // operation does not have any meaning, and will likely fail as well. to - // address this, we use a marker so the provider framework can simply - // ignore the subsequent DELETE. - if (event.RequestType === 'Create') { - exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); - resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; - } - else { - // otherwise, if PhysicalResourceId is not specified, something is - // terribly wrong because all other events should have an ID. - exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); - } - } - // this is an actual error, fail the activity altogether and exist. - await submitResponse('FAILED', resp); - } -} -function renderResponse(cfnRequest, handlerResponse = {}) { - // if physical ID is not returned, we have some defaults for you based - // on the request type. - const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; - // if we are in DELETE and physical ID was changed, it's an error. - if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { - throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); - } - // merge request event and result event (result prevails). - return { - ...cfnRequest, - ...handlerResponse, - PhysicalResourceId: physicalResourceId, - }; -} -async function submitResponse(status, event) { - const json = { - Status: status, - Reason: event.Reason ?? status, - StackId: event.StackId, - RequestId: event.RequestId, - PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, - LogicalResourceId: event.LogicalResourceId, - NoEcho: event.NoEcho, - Data: event.Data, - }; - const parsedUrl = url.parse(event.ResponseURL); - const loggingSafeUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}/${parsedUrl.pathname}?***`; - exports.external.log('submit response to cloudformation', loggingSafeUrl, json); - const responseBody = JSON.stringify(json); - const req = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { - 'content-type': '', - 'content-length': Buffer.byteLength(responseBody, 'utf8'), - }, - }; - const retryOptions = { - attempts: 5, - sleep: 1000, - }; - await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); -} -async function defaultSendHttpRequest(options, requestBody) { - return new Promise((resolve, reject) => { - try { - const request = https.request(options, (response) => { - response.resume(); // Consume the response but don't care about it - if (!response.statusCode || response.statusCode >= 400) { - reject(new Error(`Unsuccessful HTTP response: ${response.statusCode}`)); - } - else { - resolve(); - } - }); - request.on('error', reject); - request.write(requestBody); - request.end(); - } - catch (e) { - reject(e); - } - }); -} -function defaultLog(fmt, ...params) { - // eslint-disable-next-line no-console - console.log(fmt, ...params); -} -function withRetries(options, fn) { - return async (...xs) => { - let attempts = options.attempts; - let ms = options.sleep; - while (true) { - try { - return await fn(...xs); - } - catch (e) { - if (attempts-- <= 0) { - throw e; - } - await sleep(Math.floor(Math.random() * ms)); - ms *= 2; - } - } - }; -} -async function sleep(ms) { - return new Promise((ok) => setTimeout(ok, ms)); -} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/index.js deleted file mode 100644 index 013bcaffd8fe5..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/asset.a1acfc2b5f4f6b183fd2bb9863f486bc5edef6a357b355a070d9a0e502df418c/index.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var I=Object.create;var t=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var G=(r,e)=>{for(var o in e)t(r,o,{get:e[o],enumerable:!0})},n=(r,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of P(e))!l.call(r,s)&&s!==o&&t(r,s,{get:()=>e[s],enumerable:!(i=y(e,s))||i.enumerable});return r};var R=(r,e,o)=>(o=r!=null?I(g(r)):{},n(e||!r||!r.__esModule?t(o,"default",{value:r,enumerable:!0}):o,r)),S=r=>n(t({},"__esModule",{value:!0}),r);var k={};G(k,{handler:()=>f});module.exports=S(k);var a=R(require("@aws-sdk/client-ec2")),u=new a.EC2({});function c(r,e){return{GroupId:r,IpPermissions:[{UserIdGroupPairs:[{GroupId:r,UserId:e}],IpProtocol:"-1"}]}}function d(r){return{GroupId:r,IpPermissions:[{IpRanges:[{CidrIp:"0.0.0.0/0"}],IpProtocol:"-1"}]}}async function f(r){let e=r.ResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.Account;switch(r.RequestType){case"Create":return p(e,o);case"Update":return h(r);case"Delete":return m(e,o)}}async function h(r){let e=r.OldResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.DefaultSecurityGroupId;e!==o&&(await m(e,r.ResourceProperties.Account),await p(o,r.ResourceProperties.Account))}async function p(r,e){try{await u.revokeSecurityGroupEgress(d(r))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}try{await u.revokeSecurityGroupIngress(c(r,e))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}}async function m(r,e){await u.authorizeSecurityGroupIngress(c(r,e)),await u.authorizeSecurityGroupEgress(d(r))}0&&(module.exports={handler}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/cdk.out deleted file mode 100644 index c6e612584e352..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/integ.json deleted file mode 100644 index bc672af16446a..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/integ.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "38.0.1", - "testCases": { - "EnhancedMonitoringClusterInteg/DefaultTest": { - "stacks": [ - "EnhancedMonitoringClusterTestStack" - ], - "assertionStack": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert", - "assertionStackName": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/manifest.json deleted file mode 100644 index 4bfbfef78e299..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/manifest.json +++ /dev/null @@ -1,319 +0,0 @@ -{ - "version": "38.0.1", - "artifacts": { - "EnhancedMonitoringClusterTestStack.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "EnhancedMonitoringClusterTestStack.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "EnhancedMonitoringClusterTestStack": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "EnhancedMonitoringClusterTestStack.template.json", - "terminationProtection": false, - "validateOnSynth": false, - "notificationArns": [], - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d013416bf2dd28dd7ad4549beab97d275f56304997fa8c3f4b9371f4999071cf.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "EnhancedMonitoringClusterTestStack.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "EnhancedMonitoringClusterTestStack.assets" - ], - "metadata": { - "/EnhancedMonitoringClusterTestStack/Vpc/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Vpc8378EB38" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet1Subnet5C2D37C4" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet1RouteTable6C95E38E" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet1RouteTableAssociation97140677" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet1DefaultRoute3DA9E72A" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet1EIPD7E02669" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet1NATGateway4D7517AA" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet2Subnet691E08A3" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet2RouteTable94F7E489" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet2RouteTableAssociationDD5762D8" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet2DefaultRoute97F91067" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet2EIP3C605A87" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet2NATGateway9182C01D" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet1Subnet536B997A" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet1RouteTableB2C5B500" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet1RouteTableAssociation70C59FA6" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet1DefaultRouteBE02A9ED" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet2Subnet3788AAA1" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet2RouteTableA678073B" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet2RouteTableAssociationA89CAD56" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet2DefaultRoute060D2087" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/IGW": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcIGWD7BA715C" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/VPCGW": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcVPCGWBF912B6E" - } - ], - "/EnhancedMonitoringClusterTestStack/Vpc/RestrictDefaultSecurityGroupCustomResource/Default": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcRestrictDefaultSecurityGroupCustomResourceC73DA2BE" - } - ], - "/EnhancedMonitoringClusterTestStack/LatestNodeRuntimeMap": [ - { - "type": "aws:cdk:logicalId", - "data": "LatestNodeRuntimeMap" - } - ], - "/EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider": [ - { - "type": "aws:cdk:is-custom-resource-handler-customResourceProvider", - "data": true - } - ], - "/EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" - } - ], - "/EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E" - } - ], - "/EnhancedMonitoringClusterTestStack/Database/Subnets/Default": [ - { - "type": "aws:cdk:logicalId", - "data": "DatabaseSubnets56F17B9A" - } - ], - "/EnhancedMonitoringClusterTestStack/Database/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "DatabaseSecurityGroup5C91FDCB" - } - ], - "/EnhancedMonitoringClusterTestStack/Database/MonitoringRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "DatabaseMonitoringRole576991DA" - } - ], - "/EnhancedMonitoringClusterTestStack/Database/Secret/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "DatabaseSecret3B817195" - } - ], - "/EnhancedMonitoringClusterTestStack/Database/Secret/Attachment/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "DatabaseSecretAttachmentE5D1B020" - } - ], - "/EnhancedMonitoringClusterTestStack/Database/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "DatabaseB269D8BB" - } - ], - "/EnhancedMonitoringClusterTestStack/Database/writerInstance/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "DatabasewriterInstanceEBFCC003" - } - ], - "/EnhancedMonitoringClusterTestStack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/EnhancedMonitoringClusterTestStack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "EnhancedMonitoringClusterTestStack" - }, - "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.template.json", - "terminationProtection": false, - "validateOnSynth": false, - "notificationArns": [], - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "EnhancedMonitoringClusterIntegDefaultTestDeployAssertBBA17BDD.assets" - ], - "metadata": { - "/EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/tree.json deleted file mode 100644 index c2bb7f7fcb410..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.temp.js.snapshot/tree.json +++ /dev/null @@ -1,1115 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "EnhancedMonitoringClusterTestStack": { - "id": "EnhancedMonitoringClusterTestStack", - "path": "EnhancedMonitoringClusterTestStack", - "children": { - "Vpc": { - "id": "Vpc", - "path": "EnhancedMonitoringClusterTestStack/Vpc", - "children": { - "Resource": { - "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Vpc/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPC", - "aws:cdk:cloudformation:props": { - "cidrBlock": "10.0.0.0/16", - "enableDnsHostnames": true, - "enableDnsSupport": true, - "instanceTenancy": "default", - "tags": [ - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "PublicSubnet1": { - "id": "PublicSubnet1", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "availabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.0.0/18", - "mapPublicIpOnLaunch": true, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Public" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Public" - }, - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Acl": { - "id": "Acl", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/Acl", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPublicSubnet1RouteTable6C95E38E" - }, - "subnetId": { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "VpcIGWD7BA715C" - }, - "routeTableId": { - "Ref": "VpcPublicSubnet1RouteTable6C95E38E" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "EIP": { - "id": "EIP", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "allocationId": { - "Fn::GetAtt": [ - "VpcPublicSubnet1EIPD7E02669", - "AllocationId" - ] - }, - "subnetId": { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - }, - "tags": [ - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "PublicSubnet2": { - "id": "PublicSubnet2", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "availabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.64.0/18", - "mapPublicIpOnLaunch": true, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Public" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Public" - }, - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Acl": { - "id": "Acl", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/Acl", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPublicSubnet2RouteTable94F7E489" - }, - "subnetId": { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "VpcIGWD7BA715C" - }, - "routeTableId": { - "Ref": "VpcPublicSubnet2RouteTable94F7E489" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "EIP": { - "id": "EIP", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "allocationId": { - "Fn::GetAtt": [ - "VpcPublicSubnet2EIP3C605A87", - "AllocationId" - ] - }, - "subnetId": { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - }, - "tags": [ - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "PrivateSubnet1": { - "id": "PrivateSubnet1", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "availabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.128.0/18", - "mapPublicIpOnLaunch": false, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Private" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Private" - }, - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Acl": { - "id": "Acl", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/Acl", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" - }, - "subnetId": { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "VpcPublicSubnet1NATGateway4D7517AA" - }, - "routeTableId": { - "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "PrivateSubnet2": { - "id": "PrivateSubnet2", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "availabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.192.0/18", - "mapPublicIpOnLaunch": false, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Private" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Private" - }, - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Acl": { - "id": "Acl", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/Acl", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPrivateSubnet2RouteTableA678073B" - }, - "subnetId": { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "EnhancedMonitoringClusterTestStack/Vpc/PrivateSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "VpcPublicSubnet2NATGateway9182C01D" - }, - "routeTableId": { - "Ref": "VpcPrivateSubnet2RouteTableA678073B" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "IGW": { - "id": "IGW", - "path": "EnhancedMonitoringClusterTestStack/Vpc/IGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "EnhancedMonitoringClusterTestStack/Vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "VPCGW": { - "id": "VPCGW", - "path": "EnhancedMonitoringClusterTestStack/Vpc/VPCGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "internetGatewayId": { - "Ref": "VpcIGWD7BA715C" - }, - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "RestrictDefaultSecurityGroupCustomResource": { - "id": "RestrictDefaultSecurityGroupCustomResource", - "path": "EnhancedMonitoringClusterTestStack/Vpc/RestrictDefaultSecurityGroupCustomResource", - "children": { - "Default": { - "id": "Default", - "path": "EnhancedMonitoringClusterTestStack/Vpc/RestrictDefaultSecurityGroupCustomResource/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "LatestNodeRuntimeMap": { - "id": "LatestNodeRuntimeMap", - "path": "EnhancedMonitoringClusterTestStack/LatestNodeRuntimeMap", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Custom::VpcRestrictDefaultSGCustomResourceProvider": { - "id": "Custom::VpcRestrictDefaultSGCustomResourceProvider", - "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider", - "children": { - "Staging": { - "id": "Staging", - "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Role": { - "id": "Role", - "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Handler": { - "id": "Handler", - "path": "EnhancedMonitoringClusterTestStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Database": { - "id": "Database", - "path": "EnhancedMonitoringClusterTestStack/Database", - "children": { - "Subnets": { - "id": "Subnets", - "path": "EnhancedMonitoringClusterTestStack/Database/Subnets", - "children": { - "Default": { - "id": "Default", - "path": "EnhancedMonitoringClusterTestStack/Database/Subnets/Default", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::RDS::DBSubnetGroup", - "aws:cdk:cloudformation:props": { - "dbSubnetGroupDescription": "Subnets for Database database", - "subnetIds": [ - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - }, - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ] - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "EnhancedMonitoringClusterTestStack/Database/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Database/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "RDS security group", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup": { - "id": "AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup", - "path": "EnhancedMonitoringClusterTestStack/Database/AuroraPostgreSqlDatabaseClusterEngineDefaultParameterGroup", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "MonitoringRole": { - "id": "MonitoringRole", - "path": "EnhancedMonitoringClusterTestStack/Database/MonitoringRole", - "children": { - "ImportMonitoringRole": { - "id": "ImportMonitoringRole", - "path": "EnhancedMonitoringClusterTestStack/Database/MonitoringRole/ImportMonitoringRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Resource": { - "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Database/MonitoringRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "monitoring.rds.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Secret": { - "id": "Secret", - "path": "EnhancedMonitoringClusterTestStack/Database/Secret", - "children": { - "Resource": { - "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Database/Secret/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SecretsManager::Secret", - "aws:cdk:cloudformation:props": { - "description": { - "Fn::Join": [ - "", - [ - "Generated by the CDK for stack: ", - { - "Ref": "AWS::StackName" - } - ] - ] - }, - "generateSecretString": { - "passwordLength": 30, - "secretStringTemplate": "{\"username\":\"postgres\"}", - "generateStringKey": "password", - "excludeCharacters": " %+~`#$&*()|[]{}:;<>?!'/@\"\\" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Attachment": { - "id": "Attachment", - "path": "EnhancedMonitoringClusterTestStack/Database/Secret/Attachment", - "children": { - "Resource": { - "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Database/Secret/Attachment/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SecretsManager::SecretTargetAttachment", - "aws:cdk:cloudformation:props": { - "secretId": { - "Ref": "DatabaseSecret3B817195" - }, - "targetId": { - "Ref": "DatabaseB269D8BB" - }, - "targetType": "AWS::RDS::DBCluster" - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Resource": { - "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Database/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::RDS::DBCluster", - "aws:cdk:cloudformation:props": { - "copyTagsToSnapshot": true, - "dbClusterParameterGroupName": "default.aurora-postgresql16", - "dbSubnetGroupName": { - "Ref": "DatabaseSubnets56F17B9A" - }, - "engine": "aurora-postgresql", - "engineVersion": "16.1", - "masterUsername": { - "Fn::Join": [ - "", - [ - "{{resolve:secretsmanager:", - { - "Ref": "DatabaseSecret3B817195" - }, - ":SecretString:username::}}" - ] - ] - }, - "masterUserPassword": { - "Fn::Join": [ - "", - [ - "{{resolve:secretsmanager:", - { - "Ref": "DatabaseSecret3B817195" - }, - ":SecretString:password::}}" - ] - ] - }, - "monitoringInterval": 5, - "monitoringRoleArn": { - "Fn::GetAtt": [ - "DatabaseMonitoringRole576991DA", - "Arn" - ] - }, - "port": 5432, - "serverlessV2ScalingConfiguration": { - "minCapacity": 0.5, - "maxCapacity": 2 - }, - "vpcSecurityGroupIds": [ - { - "Fn::GetAtt": [ - "DatabaseSecurityGroup5C91FDCB", - "GroupId" - ] - } - ] - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "writerInstance": { - "id": "writerInstance", - "path": "EnhancedMonitoringClusterTestStack/Database/writerInstance", - "children": { - "Resource": { - "id": "Resource", - "path": "EnhancedMonitoringClusterTestStack/Database/writerInstance/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::RDS::DBInstance", - "aws:cdk:cloudformation:props": { - "dbClusterIdentifier": { - "Ref": "DatabaseB269D8BB" - }, - "dbInstanceClass": "db.serverless", - "engine": "aurora-postgresql", - "monitoringInterval": 5, - "monitoringRoleArn": { - "Fn::GetAtt": [ - "DatabaseMonitoringRole576991DA", - "Arn" - ] - }, - "promotionTier": 0 - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "EnhancedMonitoringClusterTestStack/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "EnhancedMonitoringClusterTestStack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "EnhancedMonitoringClusterInteg": { - "id": "EnhancedMonitoringClusterInteg", - "path": "EnhancedMonitoringClusterInteg", - "children": { - "DefaultTest": { - "id": "DefaultTest", - "path": "EnhancedMonitoringClusterInteg/DefaultTest", - "children": { - "Default": { - "id": "Default", - "path": "EnhancedMonitoringClusterInteg/DefaultTest/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "DeployAssert": { - "id": "DeployAssert", - "path": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert", - "children": { - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "EnhancedMonitoringClusterInteg/DefaultTest/DeployAssert/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "0.0.0" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } -} \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-rds/README.md b/packages/aws-cdk-lib/aws-rds/README.md index 548465b28a839..1e5431e65db57 100644 --- a/packages/aws-cdk-lib/aws-rds/README.md +++ b/packages/aws-cdk-lib/aws-rds/README.md @@ -1384,7 +1384,7 @@ If you want to enable enhanced monitoring at the cluster level, you can set the ```ts declare const vpc: ec2.Vpc; -// Enable Enhanced Monitoring for all of the instances in the cluster +// Enable Enhanced Monitoring at instance level to all instances in the cluster new rds.DatabaseCluster(this, 'Cluster', { engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_16_1 }), writer: rds.ClusterInstance.serverlessV2('writerInstance'), diff --git a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts index 34e90c9ae6dfc..680944bf60899 100644 --- a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts @@ -858,6 +858,8 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { // need to create the writer first since writer is determined by what instance is first const writer = props.writer!.bind(this, this, { + // When `enableClusterLevelEnhancedMonitoring` is enabled, + // both `monitoringInterval` and `monitoringRole` are set at cluster level so no need to re-set it in instance level. monitoringInterval: props.enableClusterLevelEnhancedMonitoring ? undefined : props.monitoringInterval, monitoringRole: props.enableClusterLevelEnhancedMonitoring ? undefined : this.monitoringRole, removalPolicy: props.removalPolicy ?? RemovalPolicy.SNAPSHOT, @@ -869,6 +871,8 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase { (props.readers ?? []).forEach(instance => { const clusterInstance = instance.bind(this, this, { + // When `enableClusterLevelEnhancedMonitoring` is enabled, + // both `monitoringInterval` and `monitoringRole` are set at cluster level so no need to re-set it in instance level. monitoringInterval: props.enableClusterLevelEnhancedMonitoring ? undefined : props.monitoringInterval, monitoringRole: props.enableClusterLevelEnhancedMonitoring ? undefined : this.monitoringRole, removalPolicy: props.removalPolicy ?? RemovalPolicy.SNAPSHOT, @@ -1539,6 +1543,8 @@ function legacyCreateInstances(cluster: DatabaseClusterNew, props: DatabaseClust // This is already set on the Cluster. Unclear to me whether it should be repeated or not. Better yes. dbSubnetGroupName: subnetGroup.subnetGroupName, dbParameterGroupName: instanceParameterGroupConfig?.parameterGroupName, + // When `enableClusterLevelEnhancedMonitoring` is enabled, + // both `monitoringInterval` and `monitoringRole` are set at cluster level so no need to re-set it in instance level. monitoringInterval: props.enableClusterLevelEnhancedMonitoring ? undefined : props.monitoringInterval?.toSeconds(), monitoringRoleArn: props.enableClusterLevelEnhancedMonitoring ? undefined : cluster.monitoringRole?.roleArn, autoMinorVersionUpgrade: instanceProps.autoMinorVersionUpgrade,