diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8d41ef71..5982655e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,20 +30,21 @@ The following is a checklist of steps that must be followed to add support for a a. Once you have added the new resource to `serverless-test-project`, compile the project to generate the CloudFormation JSON by running `serverless package` b. Copy `serverless-test-project/.serverless/cloudformation-template-update-stack.json` to [serverless-plugin/tests/resources/cloudformation-template-stack.json](serverless-plugin/tests/resources/cloudformation-template-stack.json`). c. Manually edit `serverless-plugin/tests/resources/cloudformation-template-stack.json` to remove any `AWS::CloudWatch::Dashboard` and `AWS::CloudWatch::Alarm` resources. This is important since we need the unit tests to generate these resources, so they cannot exist in the source template -4. Add alarms: +4. Snapshot tests are used to detect breaking or problematic changes in generated templates. They are automatically run with `npm test` but can be run in isolation with `npm run test:snapshots`. Snapshots can be regenerated (if you really are sure that they should be updated!) with `npm run test:snapshots:generate` +5. Add alarms: a. Create a new `alarms-.js` module in [serverless-plugin](./serverless-plugin/). One of the existing `alarms-.js` modules may be used as a template. b. Update [serverless-plugin/alarms.js](./serverless-plugin/alarms.js) to wire in the new `alarms-` module. c. Create a unit test for the new alarm module and update [alarms.test.js](./serverless-plugin/tests/alarms.test.js) to add coverage for the new resource. This will use the CloudFormation template you updated above. -5. Add dashboard widgets: +6. Add dashboard widgets: a. Add support for the new dashboard widgets in [serverless-plugin/dashboard.js](./serverless-plugin/dashboard.js) b. Update [dashboard.test.js](./serverless-plugin/tests/dashboard.test.js) to add coverage for the new resource -6. Update SLIC Watch configuration support: +7. Update SLIC Watch configuration support: a. Add default values for your resource's alarm and dashboard configuration in [default-config.js](./serverless-plugin/default-config.js). b. Update the JSON schema for SLIC Watch configuration ([config-schema.js](./serverless-plugin/config-schema.js)). Here, you can define the supported alarm metrics and widgets. -7. Manually (or using automation) integration test the new feature +8. Manually (or using automation) integration test the new feature a. The method will vary based on the resource type, but the idea is to trigger alarms and generate metrics to validate that both alarms and dashboards are working as expected. You can use the resource you added to `serverless-test-project` for this. b. For example integration tests, see the Python-based notebooks in [testing](./testing). -8. Update the README.md: +9. Update the README.md: a. Include the updated default configuration b. Add the new resource type to the list of features c. Update the dashboard screenshots to include your new widget with metrics shown (using Dark Mode in the CloudWatch Console!) diff --git a/cdk-test-project/.eslintrc.js b/cdk-test-project/.eslintrc.js index 7afbd1ef..f605e711 100644 --- a/cdk-test-project/.eslintrc.js +++ b/cdk-test-project/.eslintrc.js @@ -1,20 +1,5 @@ module.exports = { - root: true, - env: { - node: true - }, - plugins: [ - '@typescript-eslint' - ], - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: __dirname, - ecmaVersion: 2018 - }, rules: { 'no-new': 0 - }, - extends: [ - 'standard-with-typescript' - ] + } } diff --git a/cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts b/cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts new file mode 100644 index 00000000..4ab6f1f4 --- /dev/null +++ b/cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts @@ -0,0 +1,28 @@ +import { test } from 'tap' +import type { Template } from 'cloudform' +import { handler } from 'cf-macro-slic-watch/index' + +import { setUpSnapshotDefaults } from 'test-utils/snapshot-utils' + +import generalEuStack from './fixtures/CdkGeneralStackTest-Europe.template.json' +import generalUsStack from './fixtures/CdkGeneralStackTest-US.template.json' +import ecsStack from './fixtures/CdkECSStackTest-Europe.template.json' +import stepFunctionStack from './fixtures/CdkSFNStackTest-Europe.template.json' + +const stacks = { + generalEuStack, + generalUsStack, + ecsStack, + stepFunctionStack +} +test('cdk-test-project snapshot', async (t) => { + setUpSnapshotDefaults(t) + for (const [name, stack] of Object.entries(stacks)) { + const response = await handler({ fragment: stack as Template, requestId: 'snapshot-test' }) + t.notOk(response.errorMessage) + t.equal(response.status, 'success') + t.equal(response.requestId, 'snapshot-test') + t.matchSnapshot(response.fragment, `${name} fragment`) + } + t.end() +}) diff --git a/cdk-test-project/tests/snapshot/fixtures/CdkECSStackTest-Europe.template.json b/cdk-test-project/tests/snapshot/fixtures/CdkECSStackTest-Europe.template.json new file mode 100644 index 00000000..a1262399 --- /dev/null +++ b/cdk-test-project/tests/snapshot/fixtures/CdkECSStackTest-Europe.template.json @@ -0,0 +1,923 @@ +{ + "Transform": "SlicWatch-v3", + "Metadata": { + "slicWatch": { + "enabled": true, + "alarms": { + "Lambda": { + "Invocations": { + "enabled": true, + "Threshold": 10 + } + }, + "SQS": { + "AgeOfOldestMessage": { + "Statistic": "Maximum", + "enabled": true, + "Threshold": 60 + }, + "InFlightMessagesPc": { + "Statistic": "Maximum", + "Threshold": 1 + } + } + } + } + }, + "Resources": { + "MyWebServerLB3B5FD3AB": { + "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", + "Properties": { + "LoadBalancerAttributes": [ + { + "Key": "deletion_protection.enabled", + "Value": "false" + } + ], + "Scheme": "internet-facing", + "SecurityGroups": [ + { + "Fn::GetAtt": [ + "MyWebServerLBSecurityGroup01B285AA", + "GroupId" + ] + } + ], + "Subnets": [ + { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99" + }, + { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A" + } + ], + "Type": "application" + }, + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableAssociation8B583A17", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTableAssociation43E5803C" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/Resource" + } + }, + "MyWebServerLBSecurityGroup01B285AA": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Automatically created Security Group for ELB CdkECSStackTestEuropeMyWebServerLBE298D4B6", + "SecurityGroupIngress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow from anyone on port 80", + "FromPort": 80, + "IpProtocol": "tcp", + "ToPort": 80 + } + ], + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/SecurityGroup/Resource" + } + }, + "MyWebServerLBSecurityGrouptoCdkECSStackTestEuropeMyWebServerServiceSecurityGroup792A2ECD807CF0A9FB": { + "Type": "AWS::EC2::SecurityGroupEgress", + "Properties": { + "GroupId": { + "Fn::GetAtt": [ + "MyWebServerLBSecurityGroup01B285AA", + "GroupId" + ] + }, + "IpProtocol": "tcp", + "Description": "Load balancer to target", + "DestinationSecurityGroupId": { + "Fn::GetAtt": [ + "MyWebServerServiceSecurityGroup6788214A", + "GroupId" + ] + }, + "FromPort": 80, + "ToPort": 80 + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/SecurityGroup/to CdkECSStackTestEuropeMyWebServerServiceSecurityGroup792A2ECD:80" + } + }, + "MyWebServerLBPublicListener03D7C493": { + "Type": "AWS::ElasticLoadBalancingV2::Listener", + "Properties": { + "DefaultActions": [ + { + "TargetGroupArn": { + "Ref": "MyWebServerLBPublicListenerECSGroup5AB9F1C3" + }, + "Type": "forward" + } + ], + "LoadBalancerArn": { + "Ref": "MyWebServerLB3B5FD3AB" + }, + "Port": 80, + "Protocol": "HTTP" + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/PublicListener/Resource" + } + }, + "MyWebServerLBPublicListenerECSGroup5AB9F1C3": { + "Type": "AWS::ElasticLoadBalancingV2::TargetGroup", + "Properties": { + "Port": 80, + "Protocol": "HTTP", + "TargetGroupAttributes": [ + { + "Key": "stickiness.enabled", + "Value": "false" + } + ], + "TargetType": "ip", + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/PublicListener/ECSGroup/Resource" + } + }, + "MyWebServerTaskDefTaskRoleB23C17AA": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/TaskRole/Resource" + } + }, + "MyWebServerTaskDef4CE825A0": { + "Type": "AWS::ECS::TaskDefinition", + "Properties": { + "ContainerDefinitions": [ + { + "Essential": true, + "Image": "amazon/amazon-ecs-sample", + "LogConfiguration": { + "LogDriver": "awslogs", + "Options": { + "awslogs-group": { + "Ref": "MyWebServerTaskDefwebLogGroupC6EE23D4" + }, + "awslogs-stream-prefix": "MyWebServer", + "awslogs-region": "eu-west-1" + } + }, + "Name": "web", + "PortMappings": [ + { + "ContainerPort": 80, + "Protocol": "tcp" + } + ] + } + ], + "Cpu": "256", + "ExecutionRoleArn": { + "Fn::GetAtt": [ + "MyWebServerTaskDefExecutionRole3C69E361", + "Arn" + ] + }, + "Family": "CdkECSStackTestEuropeMyWebServerTaskDef979012A1", + "Memory": "512", + "NetworkMode": "awsvpc", + "RequiresCompatibilities": [ + "FARGATE" + ], + "TaskRoleArn": { + "Fn::GetAtt": [ + "MyWebServerTaskDefTaskRoleB23C17AA", + "Arn" + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/Resource" + } + }, + "MyWebServerTaskDefwebLogGroupC6EE23D4": { + "Type": "AWS::Logs::LogGroup", + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/web/LogGroup/Resource" + } + }, + "MyWebServerTaskDefExecutionRole3C69E361": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/ExecutionRole/Resource" + } + }, + "MyWebServerTaskDefExecutionRoleDefaultPolicy2AEB4329": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "MyWebServerTaskDefwebLogGroupC6EE23D4", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "MyWebServerTaskDefExecutionRoleDefaultPolicy2AEB4329", + "Roles": [ + { + "Ref": "MyWebServerTaskDefExecutionRole3C69E361" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/ExecutionRole/DefaultPolicy/Resource" + } + }, + "MyWebServerService2FE7341D": { + "Type": "AWS::ECS::Service", + "Properties": { + "Cluster": { + "Ref": "EcsDefaultClusterMnL3mNNYN926A5246" + }, + "DeploymentConfiguration": { + "MaximumPercent": 200, + "MinimumHealthyPercent": 50 + }, + "EnableECSManagedTags": false, + "HealthCheckGracePeriodSeconds": 60, + "LaunchType": "FARGATE", + "LoadBalancers": [ + { + "ContainerName": "web", + "ContainerPort": 80, + "TargetGroupArn": { + "Ref": "MyWebServerLBPublicListenerECSGroup5AB9F1C3" + } + } + ], + "NetworkConfiguration": { + "AwsvpcConfiguration": { + "AssignPublicIp": "DISABLED", + "SecurityGroups": [ + { + "Fn::GetAtt": [ + "MyWebServerServiceSecurityGroup6788214A", + "GroupId" + ] + } + ], + "Subnets": [ + { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C" + }, + { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73" + } + ] + } + }, + "TaskDefinition": { + "Ref": "MyWebServerTaskDef4CE825A0" + } + }, + "DependsOn": [ + "MyWebServerLBPublicListenerECSGroup5AB9F1C3", + "MyWebServerLBPublicListener03D7C493", + "MyWebServerTaskDefTaskRoleB23C17AA" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/Service/Service" + } + }, + "MyWebServerServiceSecurityGroup6788214A": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "CdkECSStackTest-Europe/MyWebServer/Service/SecurityGroup", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + } + }, + "DependsOn": [ + "MyWebServerTaskDefTaskRoleB23C17AA" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/Service/SecurityGroup/Resource" + } + }, + "MyWebServerServiceSecurityGroupfromCdkECSStackTestEuropeMyWebServerLBSecurityGroup8823910380E44CF71E": { + "Type": "AWS::EC2::SecurityGroupIngress", + "Properties": { + "IpProtocol": "tcp", + "Description": "Load balancer to target", + "FromPort": 80, + "GroupId": { + "Fn::GetAtt": [ + "MyWebServerServiceSecurityGroup6788214A", + "GroupId" + ] + }, + "SourceSecurityGroupId": { + "Fn::GetAtt": [ + "MyWebServerLBSecurityGroup01B285AA", + "GroupId" + ] + }, + "ToPort": 80 + }, + "DependsOn": [ + "MyWebServerTaskDefTaskRoleB23C17AA" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/Service/SecurityGroup/from CdkECSStackTestEuropeMyWebServerLBSecurityGroup88239103:80" + } + }, + "EcsDefaultClusterMnL3mNNYN926A5246": { + "Type": "AWS::ECS::Cluster", + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Resource" + } + }, + "EcsDefaultClusterMnL3mNNYNVpc7788A521": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/Resource" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "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": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/Subnet" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/RouteTable" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableAssociation8B583A17": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC" + }, + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/RouteTableAssociation" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F" + } + }, + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcVPCGW2447264E" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/DefaultRoute" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1EIP8704DB2F": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/EIP" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1NATGateway5E3732C1": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99" + }, + "AllocationId": { + "Fn::GetAtt": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1EIP8704DB2F", + "AllocationId" + ] + }, + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" + } + ] + }, + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableAssociation8B583A17" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/NATGateway" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "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": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/Subnet" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/RouteTable" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTableAssociation43E5803C": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5" + }, + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/RouteTableAssociation" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F" + } + }, + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcVPCGW2447264E" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/DefaultRoute" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2EIPF0764873": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/EIP" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2NATGateway4C855E00": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A" + }, + "AllocationId": { + "Fn::GetAtt": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2EIPF0764873", + "AllocationId" + ] + }, + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" + } + ] + }, + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTableAssociation43E5803C" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/NATGateway" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "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": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/Subnet" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/RouteTable" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTableAssociation34B92275": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36" + }, + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/RouteTableAssociation" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1DefaultRouteA5ADF694": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1NATGateway5E3732C1" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/DefaultRoute" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "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": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/Subnet" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/RouteTable" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableAssociation111C622F": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591" + }, + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/RouteTableAssociation" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2DefaultRoute20CE2D89": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2NATGateway4C855E00" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/DefaultRoute" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/IGW" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcVPCGW2447264E": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "InternetGatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/VPCGW" + } + }, + "CDKMetadata": { + "Type": "AWS::CDK::Metadata", + "Properties": { + "Analytics": "v2:deflate64:H4sIAAAAAAAA/31Ry27CMBD8Fu7GbTlUXCmlCAm1UYK4IsfZpgvBjux1EIry73WepLSqFGlnx+PsembG58/8cSIudiqT0zTDmJcRCXlinjqUIO0hF0RglOWLPM9QCkKttlokLyITSkLyJkwqCCIwBUpgkAlLKDOviBsFqrSY8fLv24YtP3/2Yx1aAtVpejw63/nJQGujXV5LRm3FQPqZEUhnkK6D5H9ilRqw9he9US2/z2V9tg+WLHCxXyJysQJq9AMKtSPYiTiDG3/jFtZqic3yg7gGq01Ql3dBa2/lRVxZYLCoXR1+vFF1CjAI2k26bkE+s68zKKpfbnnZhbIT9vQKn6iwH3nPaEUCva8j7i7Qxo4OZs6n0OTRwYqhOPMy1O17mxpo702zYIsqlunU77TV6eB7j6uq7j4c5Y5YCFY7047sccWUToAf7UPxNOf+m02OFnFqnCI8Aw/b+g3+NWTOyAIAAA==" + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/CDKMetadata/Default" + } + } + }, + "Outputs": { + "MyWebServerLoadBalancerDNSD1AFCC81": { + "Value": { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "DNSName" + ] + } + }, + "MyWebServerServiceURLB0ED50F6": { + "Value": { + "Fn::Join": [ + "", + [ + "http://", + { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "DNSName" + ] + } + ] + ] + } + } + }, + "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/cdk-test-project/tests/snapshot/fixtures/CdkGeneralStackTest-Europe.template.json b/cdk-test-project/tests/snapshot/fixtures/CdkGeneralStackTest-Europe.template.json new file mode 100644 index 00000000..4f449249 --- /dev/null +++ b/cdk-test-project/tests/snapshot/fixtures/CdkGeneralStackTest-Europe.template.json @@ -0,0 +1,971 @@ +{ + "Transform": "SlicWatch-v3", + "Metadata": { + "slicWatch": { + "enabled": true, + "topicArn": "arn:aws:xxxxxx:mytopic", + "alarms": { + "Lambda": { + "Invocations": { + "enabled": true, + "Threshold": 10 + } + }, + "SQS": { + "AgeOfOldestMessage": { + "Statistic": "Maximum", + "enabled": true, + "Threshold": 60 + }, + "InFlightMessagesPc": { + "Statistic": "Maximum", + "Threshold": 1 + } + } + }, + "alarmActionsConfig": { + "alarmActions": [ + { + "Ref": "MyTopic86869434" + } + ] + } + } + }, + "Resources": { + "MyTopic86869434": { + "Type": "AWS::SNS::Topic", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/MyTopic/Resource" + } + }, + "HelloHandlerServiceRole11EF7C63": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/HelloHandler/ServiceRole/Resource" + } + }, + "HelloHandler2E4FBA4D": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "HelloHandlerServiceRole11EF7C63", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "HelloHandlerServiceRole11EF7C63" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 4 + } + } + } + } + } + }, + "PingHandlerServiceRole46086423": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/PingHandler/ServiceRole/Resource" + } + }, + "PingHandler50068074": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "PingHandlerServiceRole46086423", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "PingHandlerServiceRole46086423" + ], + "Metadata": { + "slicWatch": { + "dashboard": { + "enabled": false + } + } + } + }, + "ThrottlerHandlerServiceRoleA0481DAF": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/ThrottlerHandler/ServiceRole/Resource" + } + }, + "ThrottlerHandler750A7C89": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "ThrottlerHandlerServiceRoleA0481DAF", + "Arn" + ] + }, + "Handler": "hello.handler", + "ReservedConcurrentExecutions": 0, + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "ThrottlerHandlerServiceRoleA0481DAF" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/ThrottlerHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "DriveStreamHandlerServiceRoleD2BAFDD4": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveStreamHandler/ServiceRole/Resource" + } + }, + "DriveStreamHandler62F1767B": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "DriveStreamHandlerServiceRoleD2BAFDD4", + "Arn" + ] + }, + "Handler": "stream-test-handler.handleDrive", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "DriveStreamHandlerServiceRoleD2BAFDD4" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveStreamHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "DriveQueueHandlerServiceRoleD796850A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveQueueHandler/ServiceRole/Resource" + } + }, + "DriveQueueHandler9F657A00": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "DriveQueueHandlerServiceRoleD796850A", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "DriveQueueHandlerServiceRoleD796850A" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveQueueHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "DriveTableHandlerServiceRoleDDA3FBE1": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveTableHandler/ServiceRole/Resource" + } + }, + "DriveTableHandler119966B0": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "DriveTableHandlerServiceRoleDDA3FBE1", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "DriveTableHandlerServiceRoleDDA3FBE1" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveTableHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "myapi162F20B8": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "Name": "myapi" + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Resource" + } + }, + "myapiCloudWatchRoleEB425128": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" + ] + ] + } + ] + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/CloudWatchRole/Resource" + } + }, + "myapiAccountC3A4750C": { + "Type": "AWS::ApiGateway::Account", + "Properties": { + "CloudWatchRoleArn": { + "Fn::GetAtt": [ + "myapiCloudWatchRoleEB425128", + "Arn" + ] + } + }, + "DependsOn": [ + "myapi162F20B8" + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Account" + } + }, + "myapiDeploymentB7EF8EB76dbd4bbbb18c5c458967fb55792b4830": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "Description": "Automatically created by the RestApi construct" + }, + "DependsOn": [ + "myapiproxyANYDD7FCE64", + "myapiproxyB6DF4575", + "myapiANY111D56B7" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Deployment/Resource" + } + }, + "myapiDeploymentStageprod329F21FF": { + "Type": "AWS::ApiGateway::Stage", + "Properties": { + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "DeploymentId": { + "Ref": "myapiDeploymentB7EF8EB76dbd4bbbb18c5c458967fb55792b4830" + }, + "StageName": "prod" + }, + "DependsOn": [ + "myapiAccountC3A4750C" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/DeploymentStage.prod/Resource" + } + }, + "myapiproxyB6DF4575": { + "Type": "AWS::ApiGateway::Resource", + "Properties": { + "ParentId": { + "Fn::GetAtt": [ + "myapi162F20B8", + "RootResourceId" + ] + }, + "PathPart": "{proxy+}", + "RestApiId": { + "Ref": "myapi162F20B8" + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/Resource" + } + }, + "myapiproxyANYApiPermissionCdkGeneralStackTestEuropemyapi65F2E57FANYproxyBDBDCB62": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:eu-west-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/*/*" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/ANY/ApiPermission.CdkGeneralStackTestEuropemyapi65F2E57F.ANY..{proxy+}" + } + }, + "myapiproxyANYApiPermissionTestCdkGeneralStackTestEuropemyapi65F2E57FANYproxyF17A09F1": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:eu-west-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/test-invoke-stage/*/*" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/ANY/ApiPermission.Test.CdkGeneralStackTestEuropemyapi65F2E57F.ANY..{proxy+}" + } + }, + "myapiproxyANYDD7FCE64": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "ANY", + "ResourceId": { + "Ref": "myapiproxyB6DF4575" + }, + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:eu-west-1:lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "/invocations" + ] + ] + } + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/ANY/Resource" + } + }, + "myapiANYApiPermissionCdkGeneralStackTestEuropemyapi65F2E57FANYEF4BF8F6": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:eu-west-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/*/" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/ANY/ApiPermission.CdkGeneralStackTestEuropemyapi65F2E57F.ANY.." + } + }, + "myapiANYApiPermissionTestCdkGeneralStackTestEuropemyapi65F2E57FANY3EBCCF8C": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:eu-west-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/test-invoke-stage/*/" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/ANY/ApiPermission.Test.CdkGeneralStackTestEuropemyapi65F2E57F.ANY.." + } + }, + "myapiANY111D56B7": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "ANY", + "ResourceId": { + "Fn::GetAtt": [ + "myapi162F20B8", + "RootResourceId" + ] + }, + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:eu-west-1:lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "/invocations" + ] + ] + } + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/ANY/Resource" + } + }, + "TableCD117FA1": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST" + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/Table/Resource" + } + }, + "ruleF2C1DCDC": { + "Type": "AWS::Events::Rule", + "Properties": { + "EventPattern": { + "source": [ + "aws.ec2" + ] + }, + "State": "ENABLED", + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "Arn" + ] + } + }, + "Id": "Target0", + "RetryPolicy": { + "MaximumEventAgeInSeconds": 7200, + "MaximumRetryAttempts": 2 + } + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/rule/Resource" + } + }, + "ruleAllowEventRuleCdkGeneralStackTestEuropeHelloHandlerE25EBD9DD0F76E59": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "events.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "ruleF2C1DCDC", + "Arn" + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/rule/AllowEventRuleCdkGeneralStackTestEuropeHelloHandlerE25EBD9D" + } + }, + "DeadLetterQueue9F481546": { + "Type": "AWS::SQS::Queue", + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DeadLetterQueue/Resource" + } + }, + "DeadLetterQueuePolicyB1FB890C": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "sqs:SendMessage", + "Condition": { + "ArnEquals": { + "aws:SourceArn": { + "Fn::GetAtt": [ + "ruleF2C1DCDC", + "Arn" + ] + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "events.amazonaws.com" + }, + "Resource": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "Arn" + ] + }, + "Sid": "AllowEventRuleCdkGeneralStackTestEuroperule6219EF60" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "DeadLetterQueue9F481546" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DeadLetterQueue/Policy/Resource" + } + }, + "CDKMetadata": { + "Type": "AWS::CDK::Metadata", + "Properties": { + "Analytics": "v2:deflate64:H4sIAAAAAAAA/02Q30/DIBDH/5a9M9SZmL12Gp801rr3hdKzshaoPdhsGv53D5izCeE+9z24Xxu+feC3K3HGtWy6da9qPn84ITtG0mFGg3ze20FJ9vhpEgTWC103gs/P3kinrImhJZcwaoVIXmBKaD5XtocYiDYwvD8IRHDIi2jI5zsvO3A7gcDEoFrh4CwmPr+kQhWgKwaVEvxjIaX1xrEnGHo7aSAkdeHRFG2qmoG+Wj9KSEXK0f5Mf8olceZXcF+2iVKmwJrJCG0b2ste1HmOBIHBierQfip/Gc+n8b5Jevfgk5Yh3aXtlZyuYnZDuHbG0jpit8q08dmbd4N3y/YCM7YBfsSb092W09msjqjUeqRNKA28yvYXs0P/r9UBAAA=" + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/CDKMetadata/Default" + } + } + }, + "Outputs": { + "myapiEndpoint8EB17201": { + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "myapi162F20B8" + }, + ".execute-api.eu-west-1.", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/" + ] + ] + } + } + }, + "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/cdk-test-project/tests/snapshot/fixtures/CdkGeneralStackTest-US.template.json b/cdk-test-project/tests/snapshot/fixtures/CdkGeneralStackTest-US.template.json new file mode 100644 index 00000000..31611708 --- /dev/null +++ b/cdk-test-project/tests/snapshot/fixtures/CdkGeneralStackTest-US.template.json @@ -0,0 +1,971 @@ +{ + "Transform": "SlicWatch-v3", + "Metadata": { + "slicWatch": { + "enabled": true, + "topicArn": "arn:aws:xxxxxx:mytopic", + "alarms": { + "Lambda": { + "Invocations": { + "enabled": true, + "Threshold": 10 + } + }, + "SQS": { + "AgeOfOldestMessage": { + "Statistic": "Maximum", + "enabled": true, + "Threshold": 60 + }, + "InFlightMessagesPc": { + "Statistic": "Maximum", + "Threshold": 1 + } + } + }, + "alarmActionsConfig": { + "alarmActions": [ + { + "Ref": "MyTopic86869434" + } + ] + } + } + }, + "Resources": { + "MyTopic86869434": { + "Type": "AWS::SNS::Topic", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/MyTopic/Resource" + } + }, + "HelloHandlerServiceRole11EF7C63": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/HelloHandler/ServiceRole/Resource" + } + }, + "HelloHandler2E4FBA4D": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "HelloHandlerServiceRole11EF7C63", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "HelloHandlerServiceRole11EF7C63" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 4 + } + } + } + } + } + }, + "PingHandlerServiceRole46086423": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/PingHandler/ServiceRole/Resource" + } + }, + "PingHandler50068074": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "PingHandlerServiceRole46086423", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "PingHandlerServiceRole46086423" + ], + "Metadata": { + "slicWatch": { + "dashboard": { + "enabled": false + } + } + } + }, + "ThrottlerHandlerServiceRoleA0481DAF": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/ThrottlerHandler/ServiceRole/Resource" + } + }, + "ThrottlerHandler750A7C89": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "ThrottlerHandlerServiceRoleA0481DAF", + "Arn" + ] + }, + "Handler": "hello.handler", + "ReservedConcurrentExecutions": 0, + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "ThrottlerHandlerServiceRoleA0481DAF" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/ThrottlerHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "DriveStreamHandlerServiceRoleD2BAFDD4": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveStreamHandler/ServiceRole/Resource" + } + }, + "DriveStreamHandler62F1767B": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "DriveStreamHandlerServiceRoleD2BAFDD4", + "Arn" + ] + }, + "Handler": "stream-test-handler.handleDrive", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "DriveStreamHandlerServiceRoleD2BAFDD4" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveStreamHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "DriveQueueHandlerServiceRoleD796850A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveQueueHandler/ServiceRole/Resource" + } + }, + "DriveQueueHandler9F657A00": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "DriveQueueHandlerServiceRoleD796850A", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "DriveQueueHandlerServiceRoleD796850A" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveQueueHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "DriveTableHandlerServiceRoleDDA3FBE1": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveTableHandler/ServiceRole/Resource" + } + }, + "DriveTableHandler119966B0": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "DriveTableHandlerServiceRoleDDA3FBE1", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "DriveTableHandlerServiceRoleDDA3FBE1" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveTableHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "myapi162F20B8": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "Name": "myapi" + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Resource" + } + }, + "myapiCloudWatchRoleEB425128": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" + ] + ] + } + ] + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/CloudWatchRole/Resource" + } + }, + "myapiAccountC3A4750C": { + "Type": "AWS::ApiGateway::Account", + "Properties": { + "CloudWatchRoleArn": { + "Fn::GetAtt": [ + "myapiCloudWatchRoleEB425128", + "Arn" + ] + } + }, + "DependsOn": [ + "myapi162F20B8" + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Account" + } + }, + "myapiDeploymentB7EF8EB7fea2aa51ab5416f81a0b318c3a85d817": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "Description": "Automatically created by the RestApi construct" + }, + "DependsOn": [ + "myapiproxyANYDD7FCE64", + "myapiproxyB6DF4575", + "myapiANY111D56B7" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Deployment/Resource" + } + }, + "myapiDeploymentStageprod329F21FF": { + "Type": "AWS::ApiGateway::Stage", + "Properties": { + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "DeploymentId": { + "Ref": "myapiDeploymentB7EF8EB7fea2aa51ab5416f81a0b318c3a85d817" + }, + "StageName": "prod" + }, + "DependsOn": [ + "myapiAccountC3A4750C" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/DeploymentStage.prod/Resource" + } + }, + "myapiproxyB6DF4575": { + "Type": "AWS::ApiGateway::Resource", + "Properties": { + "ParentId": { + "Fn::GetAtt": [ + "myapi162F20B8", + "RootResourceId" + ] + }, + "PathPart": "{proxy+}", + "RestApiId": { + "Ref": "myapi162F20B8" + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/Resource" + } + }, + "myapiproxyANYApiPermissionCdkGeneralStackTestUSmyapi9E6CC024ANYproxy61FC0812": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/*/*" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/ANY/ApiPermission.CdkGeneralStackTestUSmyapi9E6CC024.ANY..{proxy+}" + } + }, + "myapiproxyANYApiPermissionTestCdkGeneralStackTestUSmyapi9E6CC024ANYproxy352B4E19": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/test-invoke-stage/*/*" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/ANY/ApiPermission.Test.CdkGeneralStackTestUSmyapi9E6CC024.ANY..{proxy+}" + } + }, + "myapiproxyANYDD7FCE64": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "ANY", + "ResourceId": { + "Ref": "myapiproxyB6DF4575" + }, + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:us-east-1:lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "/invocations" + ] + ] + } + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/ANY/Resource" + } + }, + "myapiANYApiPermissionCdkGeneralStackTestUSmyapi9E6CC024ANY52E5EFEE": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/*/" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/ANY/ApiPermission.CdkGeneralStackTestUSmyapi9E6CC024.ANY.." + } + }, + "myapiANYApiPermissionTestCdkGeneralStackTestUSmyapi9E6CC024ANY1136CBF8": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/test-invoke-stage/*/" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/ANY/ApiPermission.Test.CdkGeneralStackTestUSmyapi9E6CC024.ANY.." + } + }, + "myapiANY111D56B7": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "ANY", + "ResourceId": { + "Fn::GetAtt": [ + "myapi162F20B8", + "RootResourceId" + ] + }, + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:us-east-1:lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "/invocations" + ] + ] + } + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/ANY/Resource" + } + }, + "TableCD117FA1": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST" + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/Table/Resource" + } + }, + "ruleF2C1DCDC": { + "Type": "AWS::Events::Rule", + "Properties": { + "EventPattern": { + "source": [ + "aws.ec2" + ] + }, + "State": "ENABLED", + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "Arn" + ] + } + }, + "Id": "Target0", + "RetryPolicy": { + "MaximumEventAgeInSeconds": 7200, + "MaximumRetryAttempts": 2 + } + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/rule/Resource" + } + }, + "ruleAllowEventRuleCdkGeneralStackTestUSHelloHandlerC75B8B54C6DD839C": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "events.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "ruleF2C1DCDC", + "Arn" + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/rule/AllowEventRuleCdkGeneralStackTestUSHelloHandlerC75B8B54" + } + }, + "DeadLetterQueue9F481546": { + "Type": "AWS::SQS::Queue", + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DeadLetterQueue/Resource" + } + }, + "DeadLetterQueuePolicyB1FB890C": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "sqs:SendMessage", + "Condition": { + "ArnEquals": { + "aws:SourceArn": { + "Fn::GetAtt": [ + "ruleF2C1DCDC", + "Arn" + ] + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "events.amazonaws.com" + }, + "Resource": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "Arn" + ] + }, + "Sid": "AllowEventRuleCdkGeneralStackTestUSruleB0D09E87" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "DeadLetterQueue9F481546" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DeadLetterQueue/Policy/Resource" + } + }, + "CDKMetadata": { + "Type": "AWS::CDK::Metadata", + "Properties": { + "Analytics": "v2:deflate64:H4sIAAAAAAAA/02Q30/DIBDH/5a9M9SZmL12Gp801rr3hdKzshaoPdhsGv53D5izCeE+9z24Xxu+feC3K3HGtWy6da9qPn84ITtG0mFGg3ze20FJ9vhpEgTWC103gs/P3kinrImhJZcwaoVIXmBKaD5XtocYiDYwvD8IRHDIi2jI5zsvO3A7gcDEoFrh4CwmPr+kQhWgKwaVEvxjIaX1xrEnGHo7aSAkdeHRFG2qmoG+Wj9KSEXK0f5Mf8olceZXcF+2iVKmwJrJCG0b2ste1HmOBIHBierQfip/Gc+n8b5Jevfgk5Yh3aXtlZyuYnZDuHbG0jpit8q08dmbd4N3y/YCM7YBfsSb092W09msjqjUeqRNKA28yvYXs0P/r9UBAAA=" + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/CDKMetadata/Default" + } + } + }, + "Outputs": { + "myapiEndpoint8EB17201": { + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "myapi162F20B8" + }, + ".execute-api.us-east-1.", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/" + ] + ] + } + } + }, + "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/cdk-test-project/tests/snapshot/fixtures/CdkSFNStackTest-Europe.template.json b/cdk-test-project/tests/snapshot/fixtures/CdkSFNStackTest-Europe.template.json new file mode 100644 index 00000000..59a93a0f --- /dev/null +++ b/cdk-test-project/tests/snapshot/fixtures/CdkSFNStackTest-Europe.template.json @@ -0,0 +1,274 @@ +{ + "Transform": "SlicWatch-v3", + "Metadata": { + "slicWatch": { + "enabled": true, + "alarms": { + "Lambda": { + "Invocations": { + "enabled": true, + "Threshold": 10 + } + }, + "SQS": { + "AgeOfOldestMessage": { + "Statistic": "Maximum", + "enabled": true, + "Threshold": 60 + }, + "InFlightMessagesPc": { + "Statistic": "Maximum", + "Threshold": 1 + } + } + }, + "topicArn": { + "Ref": "MyTopic86869434" + } + } + }, + "Resources": { + "MyTopic86869434": { + "Type": "AWS::SNS::Topic", + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/MyTopic/Resource" + } + }, + "HelloHandlerServiceRole11EF7C63": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/HelloHandler/ServiceRole/Resource" + } + }, + "HelloHandler2E4FBA4D": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "HelloHandlerServiceRole11EF7C63", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "HelloHandlerServiceRole11EF7C63" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 4 + } + } + } + } + } + }, + "StateMachineRoleB840431D": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.eu-west-1.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + }, + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/StateMachine/Role/Resource" + } + }, + "StateMachineRoleDefaultPolicyDF1E6607": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "StateMachineRoleDefaultPolicyDF1E6607", + "Roles": [ + { + "Ref": "StateMachineRoleB840431D" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/StateMachine/Role/DefaultPolicy/Resource" + } + }, + "StateMachine2E01A3A5": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "RoleArn": { + "Fn::GetAtt": [ + "StateMachineRoleB840431D", + "Arn" + ] + }, + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"Submit Job\",\"States\":{\"Submit Job\":{\"Next\":\"Wait X Seconds\",\"Retry\":[{\"ErrorEquals\":[\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"OutputPath\":\"$.Payload\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}},\"Wait X Seconds\":{\"Type\":\"Wait\",\"SecondsPath\":\"$.waitSeconds\",\"Next\":\"Get Job Status\"},\"Get Job Status\":{\"Next\":\"Job Complete?\",\"Retry\":[{\"ErrorEquals\":[\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"InputPath\":\"$.guid\",\"OutputPath\":\"$.Payload\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}},\"Job Complete?\":{\"Type\":\"Choice\",\"Choices\":[{\"Variable\":\"$.status\",\"StringEquals\":\"FAILED\",\"Next\":\"Job Failed\"},{\"Variable\":\"$.status\",\"StringEquals\":\"SUCCEEDED\",\"Next\":\"Get Final Job Status\"}],\"Default\":\"Wait X Seconds\"},\"Job Failed\":{\"Type\":\"Fail\",\"Error\":\"DescribeJob returned FAILED\",\"Cause\":\"AWS Batch Job Failed\"},\"Get Final Job Status\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"InputPath\":\"$.guid\",\"OutputPath\":\"$.Payload\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}},\"TimeoutSeconds\":300}" + ] + ] + } + }, + "DependsOn": [ + "StateMachineRoleDefaultPolicyDF1E6607", + "StateMachineRoleB840431D" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete", + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/StateMachine/Resource" + } + }, + "CDKMetadata": { + "Type": "AWS::CDK::Metadata", + "Properties": { + "Analytics": "v2:deflate64:H4sIAAAAAAAA/11P0UoDQQz8lr7nolaQvtpCoaAgp+Djke6lbbp7u6XZq8iy/+7etoIIgZnJhEwyx8UT3s/oSxvT28bJFtN7JGOhtLqkXjF9hJMYWO18JRkcDdueMK1Hb6IEP1m/PIPQgKkNjqd2xbfgxHxP8soy6GNHqhwVnycoGpejsRyXpAwa+bS77dMuklrFl5q58Zdg/w1g+iSJsCZxsDoEMQzlgcivZA7i6xV/dc7QsobxXOZqeDH34vf12puRwYee8ah3l4cFlprPjirSnEcfZWBsr/gDsE52pTwBAAA=" + }, + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/CDKMetadata/Default" + } + } + }, + "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/cdk-test-project/tsconfig.json b/cdk-test-project/tsconfig.json index 9f8e8bea..6843e62b 100644 --- a/cdk-test-project/tsconfig.json +++ b/cdk-test-project/tsconfig.json @@ -5,7 +5,9 @@ "lib": [ "es2018" ], + "resolveJsonModule": true, "declaration": true, + "esModuleInterop": true, "strict": true, "noImplicitAny": true, "strictNullChecks": true, diff --git a/cf-macro/index.ts b/cf-macro/index.ts index 2f1d09e8..95920451 100644 --- a/cf-macro/index.ts +++ b/cf-macro/index.ts @@ -6,7 +6,8 @@ import { setLogger } from 'slic-watch-core/logging' import { type SlicWatchConfig, resolveSlicWatchConfig } from 'slic-watch-core/inputs/general-config' import { type Template } from 'cloudform-types' -const logger = pino({ name: 'macroHandler' }) +const logger = pino({ name: 'macroHandler', level: process.env.DEBUG_LEVEL ?? 'DEBUG' }) + setLogger(logger) interface Event { @@ -29,7 +30,7 @@ export async function handler (event: Event): Promise { let status = 'success' let errorMessage: string | undefined - logger.info({ event }) + logger.debug({ event }) const transformedTemplate = event.fragment let outputFragment: Template | undefined try { @@ -58,7 +59,7 @@ export async function handler (event: Event): Promise { status = 'fail' } - logger.info({ outputFragment: transformedTemplate }) + logger.debug({ outputFragment: transformedTemplate }) return { status, diff --git a/core/dashboards/tests/dashboard.test.ts b/core/dashboards/tests/dashboard.test.ts index b9be9499..42463429 100644 --- a/core/dashboards/tests/dashboard.test.ts +++ b/core/dashboards/tests/dashboard.test.ts @@ -1,4 +1,3 @@ - import _ from 'lodash' import { test } from 'tap' diff --git a/package-lock.json b/package-lock.json index d8bec7f1..00397c8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,8 @@ "serverless-test-project", "serverless-test-project-alb", "serverless-test-project-appsync", - "sam-test-project" + "sam-test-project", + "test-utils" ], "dependencies": { "@types/lodash": "^4.14.191", @@ -12794,6 +12795,10 @@ "node": ">=8" } }, + "node_modules/test-utils": { + "resolved": "test-utils", + "link": true + }, "node_modules/text-table": { "version": "0.2.0", "dev": true, @@ -13995,6 +14000,10 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", "dev": true + }, + "test-utils": { + "version": "3.1.0", + "license": "Apache" } }, "dependencies": { @@ -22734,6 +22743,9 @@ "minimatch": "^3.0.4" } }, + "test-utils": { + "version": "file:test-utils" + }, "text-table": { "version": "0.2.0", "dev": true diff --git a/package.json b/package.json index 85db288c..98113605 100644 --- a/package.json +++ b/package.json @@ -16,14 +16,17 @@ "serverless-test-project", "serverless-test-project-alb", "serverless-test-project-appsync", - "sam-test-project" + "sam-test-project", + "test-utils" ], "scripts": { "audit": "npm audit --omit dev fix && npm audit --workspaces --omit dev", "build": "npm run build -w core && npm run build -w cf-macro && npm run build -w serverless-plugin", "lint": "eslint .", "lintfix": "eslint --cache --fix .", - "test:packages": "tap --include='**/tests/**/*.ts' --coverage-report=lcovonly --allow-incomplete-coverage", + "test:packages": "DEBUG_LEVEL=info tap --include='**/tests/**/*.ts' --coverage-report=lcovonly --allow-incomplete-coverage", + "test:snapshots": "DEBUG_LEVEL=info tap --include='**/tests/**/*snapshot.test.ts' --coverage-report=lcovonly --allow-incomplete-coverage", + "test:snapshots:generate": "TAP_SNAPSHOT=1 npm run test:snapshots", "test:report": "tap report html", "test": "npm run lint && npm run test:packages", "prepare": "test ! -d '.git' || is-ci || husky install", diff --git a/sam-test-project/template.yaml b/sam-test-project/template.yaml index c59475a4..692963df 100755 --- a/sam-test-project/template.yaml +++ b/sam-test-project/template.yaml @@ -4,16 +4,14 @@ Description: >- Transform: - AWS::Serverless-2016-10-31 - - SlicWatch-v3 Metadata: slicWatch: enabled: true - alarmActionsConfig: { - alarmActions: [!Ref MonitoringTopic], - okActions: [!Ref MonitoringTopic], + alarmActionsConfig: + alarmActions: [!Ref MonitoringTopic] + okActions: [!Ref MonitoringTopic] actionsEnabled: true - } alarms: Lambda: Invocations: diff --git a/sam-test-project/tests/snapshot/fixtures/sam-test-project-transformed-template.json b/sam-test-project/tests/snapshot/fixtures/sam-test-project-transformed-template.json new file mode 100644 index 00000000..533fafae --- /dev/null +++ b/sam-test-project/tests/snapshot/fixtures/sam-test-project-transformed-template.json @@ -0,0 +1,1029 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "sam-test-project", + "Metadata": { + "slicWatch": { + "enabled": true, + "alarmActionsConfig": { + "alarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "okActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "actionsEnabled": true + }, + "alarms": { + "Lambda": { + "Invocations": { + "enabled": true, + "Threshold": 10 + } + }, + "SQS": { + "AgeOfOldestMessage": { + "Statistic": "Maximum", + "enabled": true, + "Threshold": 60 + }, + "InFlightMessagesPc": { + "Statistic": "Maximum", + "Threshold": 1 + } + } + } + } + }, + "Resources": { + "MonitoringTopic": { + "Type": "AWS::SNS::Topic", + "Properties": { + "TopicName": "SS-Alarm-Topic3" + }, + "Metadata": { + "SamResourceId": "MonitoringTopic" + } + }, + "stream": { + "Type": "AWS::Kinesis::Stream", + "Properties": { + "ShardCount": 1 + }, + "Metadata": { + "SamResourceId": "stream" + } + }, + "regularQueue": { + "Type": "AWS::SQS::Queue", + "Metadata": { + "SamResourceId": "regularQueue" + } + }, + "fifoQueue": { + "Type": "AWS::SQS::Queue", + "Properties": { + "FifoQueue": true + }, + "Metadata": { + "SamResourceId": "fifoQueue" + } + }, + "vpc": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16" + }, + "Metadata": { + "SamResourceId": "vpc" + } + }, + "subnet": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": { + "Ref": "AWS::Region" + } + } + ] + }, + "CidrBlock": "10.0.16.0/20", + "VpcId": { + "Ref": "vpc" + } + }, + "Metadata": { + "SamResourceId": "subnet" + } + }, + "ecsCluster": { + "Type": "AWS::ECS::Cluster", + "Metadata": { + "SamResourceId": "ecsCluster" + } + }, + "ecsService": { + "Type": "AWS::ECS::Service", + "Properties": { + "Cluster": { + "Ref": "ecsCluster" + }, + "DesiredCount": 0, + "LaunchType": "FARGATE", + "TaskDefinition": { + "Ref": "taskDef" + }, + "NetworkConfiguration": { + "AwsvpcConfiguration": { + "AssignPublicIp": "ENABLED", + "SecurityGroups": [], + "Subnets": [ + { + "Ref": "subnet" + } + ] + } + } + }, + "Metadata": { + "SamResourceId": "ecsService" + } + }, + "taskDef": { + "Type": "AWS::ECS::TaskDefinition", + "Properties": { + "RequiresCompatibilities": [ + "FARGATE" + ], + "Cpu": 256, + "Memory": 512, + "ContainerDefinitions": [ + { + "Name": "busybox", + "Image": "busybox", + "Cpu": 256, + "EntryPoint": [ + "sh", + "-c" + ], + "Memory": 512, + "Command": [ + "/bin/sh -c \"while true; do echo Hello; sleep 10; done\"" + ], + "Essential": true + } + ], + "NetworkMode": "awsvpc" + }, + "Metadata": { + "SamResourceId": "taskDef" + } + }, + "dataTable": { + "Type": "AWS::DynamoDB::Table", + "DeletionPolicy": "Delete", + "Properties": { + "ProvisionedThroughput": { + "ReadCapacityUnits": 1, + "WriteCapacityUnits": 1 + }, + "AttributeDefinitions": [ + { + "AttributeName": "pk", + "AttributeType": "S" + }, + { + "AttributeName": "sk", + "AttributeType": "S" + }, + { + "AttributeName": "gsi1pk", + "AttributeType": "S" + }, + { + "AttributeName": "gsi1sk", + "AttributeType": "S" + }, + { + "AttributeName": "timestamp", + "AttributeType": "N" + } + ], + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "sk", + "KeyType": "RANGE" + } + ], + "GlobalSecondaryIndexes": [ + { + "IndexName": "GSI1", + "ProvisionedThroughput": { + "ReadCapacityUnits": 1, + "WriteCapacityUnits": 1 + }, + "KeySchema": [ + { + "AttributeName": "gsi1pk", + "KeyType": "HASH" + }, + { + "AttributeName": "gsi1sk", + "KeyType": "RANGE" + } + ], + "Projection": { + "NonKeyAttributes": [ + "address" + ], + "ProjectionType": "INCLUDE" + } + } + ], + "LocalSecondaryIndexes": [ + { + "IndexName": "LSI1", + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "timestamp", + "KeyType": "RANGE" + } + ], + "Projection": { + "NonKeyAttributes": [ + "name" + ], + "ProjectionType": "INCLUDE" + } + } + ] + }, + "Metadata": { + "SamResourceId": "dataTable" + } + }, + "hello": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "hello", + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 2 + } + } + } + } + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "Role": { + "Fn::GetAtt": [ + "helloRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "helloRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "ping": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "ping", + "slicWatch": { + "dashboard": { + "enabled": false + } + } + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "Role": { + "Fn::GetAtt": [ + "pingRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "pingRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "throttler": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "throttler" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "Role": { + "Fn::GetAtt": [ + "throttlerRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ], + "ReservedConcurrentExecutions": 0 + } + }, + "throttlerRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "driveStream": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "driveStream" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "stream-test-handler.handleDrive", + "Role": { + "Fn::GetAtt": [ + "driveStreamRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "driveStreamRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "driveQueue": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "driveQueue" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "Role": { + "Fn::GetAtt": [ + "driveQueueRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "driveQueueRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "driveTable": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "driveTable" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "Role": { + "Fn::GetAtt": [ + "driveTableRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "driveTableRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "streamProcessor": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "streamProcessor" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "Role": { + "Fn::GetAtt": [ + "streamProcessorRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "streamProcessorRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", + "arn:aws:iam::aws:policy/service-role/AWSLambdaKinesisExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "streamProcessorStream": { + "Type": "AWS::Lambda::EventSourceMapping", + "Properties": { + "EventSourceArn": { + "Fn::GetAtt": [ + "stream", + "Arn" + ] + }, + "FunctionName": { + "Ref": "streamProcessor" + }, + "MaximumRetryAttempts": 0, + "StartingPosition": "LATEST" + } + }, + "httpGetter": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "httpGetter" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "apigw-handler.handleGet", + "Role": { + "Fn::GetAtt": [ + "httpGetterRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 30, + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "httpGetterRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "httpGetterHttpApiEventPermission": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Ref": "httpGetter" + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Sub": [ + "arn:${AWS::Partition}:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/${__Stage__}/GETitem", + { + "__ApiId__": { + "Ref": "ServerlessHttpApi" + }, + "__Stage__": "*" + } + ] + } + } + }, + "eventsRule": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "eventsRule", + "slicWatch": { + "alarms": { + "Lambda": { + "enabled": false + } + } + } + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "rule-handler.handleRule", + "Role": { + "Fn::GetAtt": [ + "eventsRuleRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "eventsRuleRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "eventsRuleTrigger": { + "Type": "AWS::Events::Rule", + "Properties": { + "EventPattern": { + "detail-type": [ + "Invoke Lambda Function" + ] + }, + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "eventsRule", + "Arn" + ] + }, + "Id": "eventsRuleTriggerLambdaTarget", + "RetryPolicy": { + "MaximumRetryAttempts": 0, + "MaximumEventAgeInSeconds": 60 + } + } + ] + } + }, + "eventsRuleTriggerPermission": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Ref": "eventsRule" + }, + "Principal": "events.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "eventsRuleTrigger", + "Arn" + ] + } + } + }, + "TestStateMachine": { + "Type": "AWS::StepFunctions::StateMachine", + "Metadata": { + "SamResourceId": "TestStateMachine" + }, + "Properties": { + "DefinitionS3Location": { + "Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "Key": "sam-test-project/754f906d12f592f99c5651c04a6a0a51" + }, + "RoleArn": { + "Fn::GetAtt": [ + "TestStateMachineRole", + "Arn" + ] + }, + "Tags": [ + { + "Key": "stateMachine:createdBy", + "Value": "SAM" + } + ], + "DefinitionSubstitutions": { + "HelloArn": { + "Fn::GetAtt": [ + "hello", + "Arn" + ] + }, + "AnotherHelloArn": { + "Fn::GetAtt": [ + "hello", + "Arn" + ] + } + } + } + }, + "TestStateMachineRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "states.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [], + "Policies": [ + { + "PolicyName": "TestStateMachineRolePolicy0", + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "lambda:InvokeFunction" + ], + "Effect": "Allow", + "Resource": { + "Fn::Sub": [ + "arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:${functionName}*", + { + "functionName": { + "Ref": "hello" + } + } + ] + } + } + ] + } + }, + { + "PolicyName": "TestStateMachineRolePolicy1", + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "lambda:InvokeFunction" + ], + "Effect": "Allow", + "Resource": { + "Fn::Sub": [ + "arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:${functionName}*", + { + "functionName": { + "Ref": "hello" + } + } + ] + } + } + ] + } + } + ], + "Tags": [ + { + "Key": "stateMachine:createdBy", + "Value": "SAM" + } + ] + } + }, + "ServerlessHttpApi": { + "Type": "AWS::ApiGatewayV2::Api", + "Properties": { + "Body": { + "info": { + "version": "1.0", + "title": { + "Ref": "AWS::StackName" + } + }, + "paths": { + "item": { + "get": { + "x-amazon-apigateway-integration": { + "httpMethod": "POST", + "type": "aws_proxy", + "uri": { + "Fn::Sub": "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${httpGetter.Arn}/invocations" + }, + "payloadFormatVersion": "2.0" + }, + "responses": {} + } + } + }, + "openapi": "3.0.1", + "tags": [ + { + "name": "httpapi:createdBy", + "x-amazon-apigateway-tag-value": "SAM" + } + ] + } + } + }, + "ServerlessHttpApiApiGatewayDefaultStage": { + "Type": "AWS::ApiGatewayV2::Stage", + "Properties": { + "ApiId": { + "Ref": "ServerlessHttpApi" + }, + "StageName": "$default", + "Tags": { + "httpapi:createdBy": "SAM" + }, + "AutoDeploy": true + } + } + } +} diff --git a/sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts b/sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts new file mode 100644 index 00000000..a2abb219 --- /dev/null +++ b/sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts @@ -0,0 +1,16 @@ +import { test } from 'tap' +import type { Template } from 'cloudform' +import { handler } from 'cf-macro-slic-watch/index' + +import inputTemplate from './fixtures/sam-test-project-transformed-template.json' +import { setUpSnapshotDefaults } from 'test-utils/snapshot-utils' + +test('sam-test-project snapshot', async (t) => { + setUpSnapshotDefaults(t) + const response = await handler({ fragment: inputTemplate as Template, requestId: 'snapshot-test' }) + t.notOk(response.errorMessage) + t.equal(response.status, 'success') + t.equal(response.requestId, 'snapshot-test') + t.matchSnapshot(response.fragment, 'fragment') + t.end() +}) diff --git a/serverless-plugin/tests/index.test.ts b/serverless-plugin/tests/index.test.ts index dddcd764..9c08bc7a 100644 --- a/serverless-plugin/tests/index.test.ts +++ b/serverless-plugin/tests/index.test.ts @@ -2,44 +2,17 @@ import { test } from 'tap' import _ from 'lodash' import ServerlessError from 'serverless/lib/serverless-error' -import pino from 'pino' - import ServerlessPlugin from '../serverless-plugin' import { getLogger } from 'slic-watch-core/logging' +import { createMockServerless, dummyLogger, pluginUtils, slsYaml } from '../../test-utils/sls-test-utils' +import { type ResourceType } from 'slic-watch-core' interface TestData { schema? functionSchema? } -interface SlsYaml { - custom? - functions? -} - -// Serverless Framework provides plugins with a logger to use, so we simulate that with this: -const logger = Object.assign({}, pino()) -const extras = ['levels', 'silent', 'onChild', 'trace', 'debug', 'info', 'warn', 'error', 'fatal'] -for (const extra of extras) { - // eslint-disable-next-line @typescript-eslint/no-dynamic-delete - delete logger[extra] -} -const pluginUtils = { log: logger } - -const slsYaml: SlsYaml = { - custom: { - slicWatch: { - topicArn: 'test-topic', - enabled: true - } - }, - functions: { - hello: { - } - } -} - -const testCfTemplate = { +const mockServerless = createMockServerless({ Resources: { HelloLambdaFunction: { Type: 'AWS::Lambda::Function', @@ -48,30 +21,7 @@ const testCfTemplate = { } } } -} - -const mockServerless = { - cli: { - log: () => { '' } - }, - providers: { aws: {} }, - getProvider: () => ({ - naming: { - getLambdaLogicalId: (funcName: string) => { - return funcName[0].toUpperCase() + funcName.slice(1) + 'LambdaFunction' - } - } - }), - service: { - ...slsYaml, - provider: { - name: 'aws', - compiledCloudFormationTemplate: testCfTemplate - }, - getAllFunctions: () => Object.keys(slsYaml.functions), - getFunction: (funcRef) => slsYaml.functions[funcRef] - } -} +}) function compileServerlessFunctionsToCloudformation (functions: Record, provider: () => { naming: { getLambdaLogicalId: (funcName: string) => string } @@ -94,7 +44,7 @@ test('index', t => { t.test('plugin uses v3 logger', t => { // Since v3, Serverless Framework provides a logger that we must use to log output const plugin = new ServerlessPlugin(mockServerless, null, pluginUtils) - t.same(getLogger(), logger) + t.same(getLogger(), dummyLogger) t.ok(plugin) t.end() }) @@ -221,34 +171,21 @@ test('index', t => { }) t.test('should create only the dashboard when a lambda is not referenced in the serverless functions config', t => { - const mockServerless = { - getProvider: () => { - }, - service: { - getAllFunctions: () => [], - provider: { - name: 'aws', - compiledCloudFormationTemplate: { - Resources: { - HelloTestLambda: { - Type: 'AWS::Lambda::Function', - MemorySize: 256, - Runtime: 'nodejs12', - Timeout: 60 - } - } - } - }, - custom: { - slicWatch: { - enabled: true + const mockServerless = createMockServerless({ + Resources: { + HelloTestLambda: { + Type: 'AWS::Lambda::Function', + Properties: { + MemorySize: 256, + Runtime: 'nodejs12', + Timeout: 60 } } } - } + }) const plugin = new ServerlessPlugin(mockServerless, null, pluginUtils) plugin.createSlicWatchResources() - t.same(Object.keys(mockServerless.service.provider.compiledCloudFormationTemplate.Resources), ['HelloTestLambda', 'slicWatchDashboard']) + t.same(Object.keys(mockServerless.service.provider.compiledCloudFormationTemplate.Resources as ResourceType), ['HelloTestLambda', 'slicWatchDashboard']) t.end() }) diff --git a/serverless-test-project-alb/tests/snapshot/fixtures/cloudformation-template-update-stack.json b/serverless-test-project-alb/tests/snapshot/fixtures/cloudformation-template-update-stack.json new file mode 100644 index 00000000..967cc2d8 --- /dev/null +++ b/serverless-test-project-alb/tests/snapshot/fixtures/cloudformation-template-update-stack.json @@ -0,0 +1,561 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "The AWS CloudFormation template for this Serverless application", + "Resources": { + "ServerlessDeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + } + }, + "ServerlessDeploymentBucketPolicy": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Effect": "Deny", + "Principal": "*", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "ServerlessDeploymentBucket" + }, + "/*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "ServerlessDeploymentBucket" + } + ] + ] + } + ], + "Condition": { + "Bool": { + "aws:SecureTransport": false + } + } + } + ] + } + } + }, + "AlbEventLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-alb-dev-albEvent" + } + }, + "IamRoleLambdaExecution": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + }, + "Policies": [ + { + "PolicyName": { + "Fn::Join": [ + "-", + [ + "serverless-test-project-alb", + "dev", + "lambda" + ] + ] + }, + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogStream", + "logs:CreateLogGroup", + "logs:TagResource" + ], + "Resource": [ + { + "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/serverless-test-project-alb-dev*:*" + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "logs:PutLogEvents" + ], + "Resource": [ + { + "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/serverless-test-project-alb-dev*:*:*" + } + ] + } + ] + } + } + ], + "Path": "/", + "RoleName": { + "Fn::Join": [ + "-", + [ + "serverless-test-project-alb", + "dev", + { + "Ref": "AWS::Region" + }, + "lambdaRole" + ] + ] + } + } + }, + "AlbEventLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project-alb/dev/1701242684385-2023-11-29T07:24:44.385Z/serverless-test-project-alb.zip" + }, + "Handler": "alb-handler.handleALB", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-alb-dev-albEvent", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "AlbEventLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "AlbEventLambdaVersion0XznAenLykwY99KhRhuWhGA2GO8nTdlRqGtjPoaDgg": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "AlbEventLambdaFunction" + }, + "CodeSha256": "iF0ZcJ5dWZd/RnBzvEqO7WAQlHbLsco8p4dUx4U7AL8=" + } + }, + "AlbEventAlbTargetGrouphttpListener": { + "Type": "AWS::ElasticLoadBalancingV2::TargetGroup", + "Properties": { + "TargetType": "lambda", + "Targets": [ + { + "Id": { + "Fn::GetAtt": [ + "AlbEventLambdaFunction", + "Arn" + ] + } + } + ], + "Name": "1d5fdfd5099ec257209ef7b7c5ee8cb4", + "Tags": [ + { + "Key": "Name", + "Value": "serverless-test-project-alb-albEvent-httpListener-dev" + } + ], + "TargetGroupAttributes": [ + { + "Key": "lambda.multi_value_headers.enabled", + "Value": false + } + ], + "HealthCheckEnabled": true, + "HealthCheckPath": "/", + "HealthCheckIntervalSeconds": 35, + "HealthCheckTimeoutSeconds": 30, + "HealthyThresholdCount": 5, + "UnhealthyThresholdCount": 5, + "Matcher": { + "HttpCode": "200" + } + }, + "DependsOn": [ + "AlbEventLambdaPermissionRegisterTarget" + ] + }, + "AlbEventAlbListenerRule1": { + "Type": "AWS::ElasticLoadBalancingV2::ListenerRule", + "Properties": { + "Actions": [ + { + "Type": "forward", + "TargetGroupArn": { + "Ref": "AlbEventAlbTargetGrouphttpListener" + } + } + ], + "Conditions": [ + { + "Field": "path-pattern", + "Values": [ + "/handleALB" + ] + }, + { + "Field": "http-request-method", + "HttpRequestMethodConfig": { + "Values": [ + "POST" + ] + } + } + ], + "ListenerArn": { + "Ref": "httpListener" + }, + "Priority": 1 + } + }, + "AlbEventLambdaPermissionAlb": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "FunctionName": { + "Fn::GetAtt": [ + "AlbEventLambdaFunction", + "Arn" + ] + }, + "Action": "lambda:InvokeFunction", + "Principal": "elasticloadbalancing.amazonaws.com", + "SourceArn": { + "Ref": "AlbEventAlbTargetGrouphttpListener" + } + } + }, + "AlbEventLambdaPermissionRegisterTarget": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "FunctionName": { + "Fn::GetAtt": [ + "AlbEventLambdaFunction", + "Arn" + ] + }, + "Action": "lambda:InvokeFunction", + "Principal": "elasticloadbalancing.amazonaws.com" + } + }, + "bucket": { + "Type": "AWS::S3::Bucket" + }, + "vpcALB": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/20", + "EnableDnsSupport": true, + "EnableDnsHostnames": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + } + }, + "internetGateway": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + } + }, + "vpcGatewayAttachment": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "VpcId": { + "Ref": "vpcALB" + }, + "InternetGatewayId": { + "Ref": "internetGateway" + } + } + }, + "subnetA": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": "eu-west-1a", + "CidrBlock": "10.0.5.0/24", + "VpcId": { + "Ref": "vpcALB" + }, + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + } + }, + "subnetB": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": "eu-west-1b", + "CidrBlock": "10.0.6.0/24", + "VpcId": { + "Ref": "vpcALB" + }, + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + } + }, + "routeTableA": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "vpcALB" + }, + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + } + }, + "routeTableB": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "vpcALB" + }, + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + } + }, + "routeTableAssociationSubnetA": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "SubnetId": { + "Ref": "subnetA" + }, + "RouteTableId": { + "Ref": "routeTableA" + } + } + }, + "routeTableAssociationSubnetB": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "SubnetId": { + "Ref": "subnetB" + }, + "RouteTableId": { + "Ref": "routeTableB" + } + } + }, + "routeTableAInternetRoute": { + "Type": "AWS::EC2::Route", + "DependsOn": [ + "vpcGatewayAttachment" + ], + "Properties": { + "RouteTableId": { + "Ref": "routeTableA" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "internetGateway" + } + } + }, + "routeTableBInternetRoute": { + "Type": "AWS::EC2::Route", + "DependsOn": [ + "vpcGatewayAttachment" + ], + "Properties": { + "RouteTableId": { + "Ref": "routeTableB" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "internetGateway" + } + } + }, + "alb": { + "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", + "Properties": { + "Name": "awesome-loadBalancer", + "Type": "application", + "Subnets": [ + { + "Ref": "subnetA" + }, + { + "Ref": "subnetB" + } + ], + "SecurityGroups": [ + { + "Ref": "albSecurityGroup" + } + ] + } + }, + "httpListener": { + "Type": "AWS::ElasticLoadBalancingV2::Listener", + "Properties": { + "LoadBalancerArn": { + "Ref": "alb" + }, + "Port": 80, + "Protocol": "HTTP", + "DefaultActions": [ + { + "Type": "redirect", + "RedirectConfig": { + "Protocol": "HTTP", + "Port": 400, + "Host": "#{host}", + "Path": "/#{path}", + "Query": "#{query}", + "StatusCode": "HTTP_301" + } + } + ] + } + }, + "albSecurityGroup": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Allow http to client host", + "VpcId": { + "Ref": "vpcALB" + }, + "SecurityGroupIngress": [ + { + "IpProtocol": "tcp", + "FromPort": 80, + "ToPort": 80, + "CidrIp": "0.0.0.0/0" + }, + { + "IpProtocol": "tcp", + "FromPort": 443, + "ToPort": 443, + "CidrIp": "0.0.0.0/0" + } + ] + } + } + }, + "Outputs": { + "ServerlessDeploymentBucketName": { + "Value": { + "Ref": "ServerlessDeploymentBucket" + }, + "Export": { + "Name": "sls-serverless-test-project-alb-dev-ServerlessDeploymentBucketName" + } + }, + "AlbEventLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "AlbEventLambdaVersion0XznAenLykwY99KhRhuWhGA2GO8nTdlRqGtjPoaDgg" + }, + "Export": { + "Name": "sls-serverless-test-project-alb-dev-AlbEventLambdaFunctionQualifiedArn" + } + } + } +} diff --git a/serverless-test-project-alb/tests/snapshot/serverless-test-project-alb-snapshot.test.ts b/serverless-test-project-alb/tests/snapshot/serverless-test-project-alb-snapshot.test.ts new file mode 100644 index 00000000..ee94ca0c --- /dev/null +++ b/serverless-test-project-alb/tests/snapshot/serverless-test-project-alb-snapshot.test.ts @@ -0,0 +1,22 @@ +import { test } from 'tap' +import { type Template } from 'cloudform-types' + +import ServerlessPlugin from 'serverless-slic-watch-plugin/serverless-plugin' + +import inputTemplate from './fixtures/cloudformation-template-update-stack.json' +import { createMockServerless } from 'test-utils/sls-test-utils' +import { setUpSnapshotDefaults } from 'test-utils/snapshot-utils' + +const logger = {} + +const pluginUtils = { log: logger } + +test('serverless-test-project-alb snapshot', (t) => { + setUpSnapshotDefaults(t) + const mockServerless = createMockServerless(inputTemplate as Template) + const plugin = new ServerlessPlugin(mockServerless, null, pluginUtils) + plugin.createSlicWatchResources() + const generatedTemplate = mockServerless.service.provider.compiledCloudFormationTemplate + t.matchSnapshot(generatedTemplate, 'serverless-test-project-alb template') + t.end() +}) diff --git a/serverless-test-project-appsync/tests/snapshot/fixtures/cloudformation-template-update-stack.json b/serverless-test-project-appsync/tests/snapshot/fixtures/cloudformation-template-update-stack.json new file mode 100644 index 00000000..93e15279 --- /dev/null +++ b/serverless-test-project-appsync/tests/snapshot/fixtures/cloudformation-template-update-stack.json @@ -0,0 +1,516 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "The AWS CloudFormation template for this Serverless application", + "Resources": { + "ServerlessDeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + } + }, + "ServerlessDeploymentBucketPolicy": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Effect": "Deny", + "Principal": "*", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "ServerlessDeploymentBucket" + }, + "/*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "ServerlessDeploymentBucket" + } + ] + ] + } + ], + "Condition": { + "Bool": { + "aws:SecureTransport": false + } + } + } + ] + } + } + }, + "bucket": { + "Type": "AWS::S3::Bucket" + }, + "BooksTable": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "bookId", + "KeyType": "HASH" + } + ], + "AttributeDefinitions": [ + { + "AttributeName": "bookId", + "AttributeType": "S" + } + ], + "Tags": [ + { + "Key": "Name", + "Value": "books-table" + } + ] + } + }, + "CognitoUserPool": { + "Type": "AWS::Cognito::UserPool", + "Properties": { + "AutoVerifiedAttributes": [ + "email" + ], + "Policies": { + "PasswordPolicy": { + "MinimumLength": 8, + "RequireLowercase": false, + "RequireNumbers": false, + "RequireUppercase": false, + "RequireSymbols": false + } + }, + "UsernameAttributes": [ + "email" + ], + "Schema": [ + { + "AttributeDataType": "String", + "Name": "name", + "Required": false, + "Mutable": true + } + ], + "UserPoolName": "BookStoreUserPool" + } + }, + "CognitoUserPoolClient": { + "Type": "AWS::Cognito::UserPoolClient", + "Properties": { + "UserPoolId": { + "Ref": "CognitoUserPool" + }, + "ClientName": "web", + "ExplicitAuthFlows": [ + "ALLOW_USER_SRP_AUTH", + "ALLOW_USER_PASSWORD_AUTH", + "ALLOW_REFRESH_TOKEN_AUTH" + ], + "PreventUserExistenceErrors": "ENABLED" + } + }, + "CognitoAdminGroup": { + "Type": "AWS::Cognito::UserPoolGroup", + "Properties": { + "UserPoolId": { + "Ref": "CognitoUserPool" + }, + "GroupName": "Admin", + "RoleArn": { + "Fn::GetAtt": [ + "CognitoAdminIAMrole", + "Arn" + ] + }, + "Description": "Admin users belong to this group" + } + }, + "CognitoAdminIAMrole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Federated": [ + "cognito-identity.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRoleWithWebIdentity" + ] + } + ] + }, + "Description": "This is the IAM role that admin group users name", + "Policies": [ + { + "PolicyName": "bookstore-admin-group-policy", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "dynamodb:*" + ], + "Resource": [ + { + "Fn::GetAtt": [ + "BooksTable", + "Arn" + ] + } + ] + } + ] + } + } + ], + "RoleName": "bookstore-admin-role" + } + }, + "CognitoCustomerGroup": { + "Type": "AWS::Cognito::UserPoolGroup", + "Properties": { + "UserPoolId": { + "Ref": "CognitoUserPool" + }, + "GroupName": "Customer", + "RoleArn": { + "Fn::GetAtt": [ + "CognitoUserIAMrole", + "Arn" + ] + }, + "Description": "Customer belongs to this group" + } + }, + "CognitoUserIAMrole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Federated": [ + "cognito-identity.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRoleWithWebIdentity" + ] + } + ] + }, + "Description": "This is the IAM role that admin group users name", + "Policies": [ + { + "PolicyName": "book-store-customer-group-policy", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "dynamodb:GetItem", + "dynamodb:Query", + "dynamodb:BatchGetItem" + ], + "Resource": [ + { + "Fn::GetAtt": [ + "BooksTable", + "Arn" + ] + } + ] + } + ] + } + } + ], + "RoleName": "bookstore-customer-role" + } + }, + "AwesomeappsyncGraphQlApi": { + "Type": "AWS::AppSync::GraphQLApi", + "Properties": { + "Name": "awesome-appsync", + "AuthenticationType": "AMAZON_COGNITO_USER_POOLS", + "AdditionalAuthenticationProviders": [], + "UserPoolConfig": { + "AwsRegion": "eu-west-1", + "UserPoolId": { + "Ref": "CognitoUserPool" + }, + "DefaultAction": "ALLOW" + }, + "XrayEnabled": false + } + }, + "AwesomeappsyncGraphQlSchema": { + "Type": "AWS::AppSync::GraphQLSchema", + "Properties": { + "Definition": "schema {\n query: Query\n mutation: Mutation\n subscription: Subscription\n}\n\ntype Subscription {\n onCreateBook: Book @aws_subscribe(mutations: [\"createBook\"])\n}\n\ntype Query {\n getBookById(bookId: ID!): Book!\n}\n\ntype Book {\n bookId: ID!\n title: String!\n description: String\n imageUrl: AWSURL\n author: String!\n price: Float!\n createdAt: AWSDateTime!\n updatedAt: AWSDateTime!\n}\n\ntype Mutation {\n createBook(newBook: BookInput): Book! @aws_auth(cognito_groups: [\"Admin\"])\n}\n\ninput BookInput {\n title: String!\n description: String\n imageUrl: AWSURL\n author: String!\n price: Float!\n}", + "ApiId": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + } + } + }, + "AwesomeappsyncGraphQlDsbooksTableRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "appsync.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + }, + "Policies": [ + { + "PolicyName": "GraphQlDsbooksTablePolicy", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "dynamodb:DeleteItem", + "dynamodb:GetItem", + "dynamodb:PutItem", + "dynamodb:Query", + "dynamodb:Scan", + "dynamodb:UpdateItem", + "dynamodb:BatchGetItem", + "dynamodb:BatchWriteItem", + "dynamodb:ConditionCheckItem" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + ":", + [ + "arn", + "aws", + "dynamodb", + "eu-west-1", + { + "Ref": "AWS::AccountId" + }, + { + "Fn::Join": [ + "/", + [ + "table", + { + "Ref": "BooksTable" + } + ] + ] + } + ] + ] + }, + { + "Fn::Join": [ + "/", + [ + { + "Fn::Join": [ + ":", + [ + "arn", + "aws", + "dynamodb", + "eu-west-1", + { + "Ref": "AWS::AccountId" + }, + { + "Fn::Join": [ + "/", + [ + "table", + { + "Ref": "BooksTable" + } + ] + ] + } + ] + ] + }, + "*" + ] + ] + } + ] + } + ] + } + } + ] + } + }, + "AwesomeappsyncGraphQlDsbooksTable": { + "Type": "AWS::AppSync::DataSource", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + }, + "Name": "booksTable", + "Type": "AMAZON_DYNAMODB", + "ServiceRoleArn": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlDsbooksTableRole", + "Arn" + ] + }, + "DynamoDBConfig": { + "AwsRegion": "eu-west-1", + "TableName": { + "Ref": "BooksTable" + }, + "UseCallerCredentials": false, + "Versioned": false + } + } + }, + "AwesomeappsyncGraphQlResolverQuerygetBookById": { + "Type": "AWS::AppSync::Resolver", + "DependsOn": "AwesomeappsyncGraphQlSchema", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + }, + "TypeName": "Query", + "FieldName": "getBookById", + "RequestMappingTemplate": "#if ($context.info.selectionSetList.size() == 1 && $context.info.selectionSetList[0] == \"id\")\n #set ($result = { \"id\": \"$context.source.otherUserId\" })\n\n #return($result)\n#end\n\n{\n \"version\" : \"2018-05-29\",\n \"operation\" : \"GetItem\",\n \"key\" : {\n \"bookId\" : $util.dynamodb.toDynamoDBJson($context.arguments.bookId)\n }\n}", + "ResponseMappingTemplate": "$util.toJson($context.result)", + "Kind": "UNIT", + "DataSourceName": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlDsbooksTable", + "Name" + ] + } + } + }, + "AwesomeappsyncGraphQlResolverMutationcreateBook": { + "Type": "AWS::AppSync::Resolver", + "DependsOn": "AwesomeappsyncGraphQlSchema", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + }, + "TypeName": "Mutation", + "FieldName": "createBook", + "RequestMappingTemplate": "{\n \"version\" : \"2018-05-29\",\n \"operation\" : \"PutItem\",\n \"key\": {\n \"bookId\" : $util.dynamodb.toDynamoDBJson($util.autoId())\n },\n \"attributeValues\" : {\n \"title\" : $util.dynamodb.toDynamoDBJson($context.arguments.newBook.title),\n \"description\" : $util.dynamodb.toDynamoDBJson($context.arguments.newBook.description),\n \"imageUrl\" : $util.dynamodb.toDynamoDBJson($context.arguments.newBook.imageUrl),\n \"author\" : $util.dynamodb.toDynamoDBJson($context.arguments.newBook.author),\n \"price\" : $util.dynamodb.toDynamoDBJson($context.arguments.newBook.price),\n \"createdAt\": $util.dynamodb.toDynamoDBJson($util.time.nowISO8601()),\n \"updatedAt\": $util.dynamodb.toDynamoDBJson($util.time.nowISO8601())\n }\n}", + "ResponseMappingTemplate": "$util.toJson($context.result)", + "Kind": "UNIT", + "DataSourceName": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlDsbooksTable", + "Name" + ] + } + } + } + }, + "Outputs": { + "ServerlessDeploymentBucketName": { + "Value": { + "Ref": "ServerlessDeploymentBucket" + }, + "Export": { + "Name": "sls-serverless-test-project-appsync-dev-ServerlessDeploymentBucketName" + } + }, + "AwesomeappsyncGraphQlApiId": { + "Value": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-AwesomeappsyncGraphQlApiId" + } + } + }, + "AwesomeappsyncGraphQlApiUrl": { + "Value": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "GraphQLUrl" + ] + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-AwesomeappsyncGraphQlApiUrl" + } + } + } + } +} diff --git a/serverless-test-project-appsync/tests/snapshot/serverless-test-project-appsync-snapshot.test.ts b/serverless-test-project-appsync/tests/snapshot/serverless-test-project-appsync-snapshot.test.ts new file mode 100644 index 00000000..bcf0b24b --- /dev/null +++ b/serverless-test-project-appsync/tests/snapshot/serverless-test-project-appsync-snapshot.test.ts @@ -0,0 +1,22 @@ +import { test } from 'tap' +import { type Template } from 'cloudform-types' + +import ServerlessPlugin from 'serverless-slic-watch-plugin/serverless-plugin' + +import inputTemplate from './fixtures/cloudformation-template-update-stack.json' +import { createMockServerless } from 'test-utils/sls-test-utils' +import { setUpSnapshotDefaults } from 'test-utils/snapshot-utils' + +const logger = {} + +const pluginUtils = { log: logger } + +test('serverless-test-project-appsync snapshot', (t) => { + setUpSnapshotDefaults(t) + const mockServerless = createMockServerless(inputTemplate as unknown as Template) + const plugin = new ServerlessPlugin(mockServerless, null, pluginUtils) + plugin.createSlicWatchResources() + const generatedTemplate = mockServerless.service.provider.compiledCloudFormationTemplate + t.matchSnapshot(generatedTemplate, 'serverless-test-project-appsync template') + t.end() +}) diff --git a/serverless-test-project/tests/snapshot/fixtures/cloudformation-template-update-stack.json b/serverless-test-project/tests/snapshot/fixtures/cloudformation-template-update-stack.json new file mode 100644 index 00000000..ae39d840 --- /dev/null +++ b/serverless-test-project/tests/snapshot/fixtures/cloudformation-template-update-stack.json @@ -0,0 +1,1548 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "The AWS CloudFormation template for this Serverless application", + "Resources": { + "ServerlessDeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + } + }, + "ServerlessDeploymentBucketPolicy": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Effect": "Deny", + "Principal": "*", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "ServerlessDeploymentBucket" + }, + "/*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "ServerlessDeploymentBucket" + } + ] + ] + } + ], + "Condition": { + "Bool": { + "aws:SecureTransport": false + } + } + } + ] + } + } + }, + "HelloLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-hello" + } + }, + "PingLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-ping" + } + }, + "ThrottlerLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-throttler" + } + }, + "DriveStreamLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-driveStream" + } + }, + "DriveQueueLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-driveQueue" + } + }, + "DriveTableLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-driveTable" + } + }, + "StreamProcessorLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-streamProcessor" + } + }, + "HttpGetterLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-httpGetter" + } + }, + "SubscriptionHandlerLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-subscriptionHandler" + } + }, + "EventsRuleLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-eventsRule" + } + }, + "IamRoleLambdaExecution": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + }, + "Policies": [ + { + "PolicyName": { + "Fn::Join": [ + "-", + [ + "serverless-test-project", + "dev", + "lambda" + ] + ] + }, + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogStream", + "logs:CreateLogGroup", + "logs:TagResource" + ], + "Resource": [ + { + "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/serverless-test-project-dev*:*" + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "logs:PutLogEvents" + ], + "Resource": [ + { + "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/serverless-test-project-dev*:*:*" + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "kinesis:GetRecords", + "kinesis:GetShardIterator", + "kinesis:DescribeStream", + "kinesis:ListStreams" + ], + "Resource": [ + { + "Fn::GetAtt": [ + "stream", + "Arn" + ] + } + ] + } + ] + } + } + ], + "Path": "/", + "RoleName": { + "Fn::Join": [ + "-", + [ + "serverless-test-project", + "dev", + { + "Ref": "AWS::Region" + }, + "lambdaRole" + ] + ] + } + } + }, + "HelloLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "basic-handler.hello", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-hello", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "HelloLogGroup" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 2 + } + } + } + } + } + }, + "PingLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "basic-handler.hello", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-ping", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "PingLogGroup" + ], + "Metadata": { + "slicWatch": { + "dashboard": { + "enabled": false + } + } + } + }, + "ThrottlerLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "basic-handler.hello", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-throttler", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + }, + "ReservedConcurrentExecutions": 0 + }, + "DependsOn": [ + "ThrottlerLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "DriveStreamLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "stream-test-handler.handleDrive", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-driveStream", + "MemorySize": 1024, + "Timeout": 6, + "Environment": { + "Variables": { + "STREAM_NAME": { + "Ref": "stream" + } + } + }, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "DriveStreamLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "DriveQueueLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "queue-test-handler.handleDrive", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-driveQueue", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "DriveQueueLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "DriveTableLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "table-test-hander.handleDrive", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-driveTable", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "DriveTableLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "StreamProcessorLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "stream-handler.handle", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-streamProcessor", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "StreamProcessorLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "HttpGetterLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "apigw-handler.handleGet", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-httpGetter", + "MemorySize": 1024, + "Timeout": 30, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "HttpGetterLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "SubscriptionHandlerLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "apigw-handler.handleSubscription", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-subscriptionHandler", + "MemorySize": 1024, + "Timeout": 30, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "SubscriptionHandlerLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "EventsRuleLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "rule-handler.handleRule", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-eventsRule", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "EventsRuleLogGroup" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "enabled": false + } + } + } + } + }, + "HelloLambdaVersioncvZrQjYr4FdYsM3CaTj5TKuOJmUjyL07tfIDVXBSw4": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "HelloLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "PingLambdaVersionSQcuddhSFqI0xKYCyuQTTJMvwrlKCB77CNQ16xyQ": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "PingLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "ThrottlerLambdaVersion0UeWLgxZYywcyV3gGiutpyCQJEbO6Gk8zSSOP7dMEps": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "ThrottlerLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "DriveStreamLambdaVersionsWkqlV7IV7mJdqIqQToVljMizTzZoDCso7qMazjI": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "DriveStreamLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "DriveQueueLambdaVersionTmzx8HCxfunJ3etrLOOYLg8zG05MzRauykeVpZFz8WY": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "DriveQueueLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "DriveTableLambdaVersionkqI0DCnUasgza04mnCpqj0q5vePTOojYtyi4hxfE3ME": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "DriveTableLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "StreamProcessorLambdaVersion24Kwch4oq5ogXKcIDJuLGB1qAJWt8aqgW43aCjKI": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "StreamProcessorLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "HttpGetterLambdaVersionvK2ALwc1DFqBccIyulxoBU3GveALO98nQc2xP94J8": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "HttpGetterLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "SubscriptionHandlerLambdaVersion4kKEYaIgWsMN0XYzRQn4VAailfQcZ23kdSSOKepfB4A": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "SubscriptionHandlerLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "EventsRuleLambdaVersionxBuN447jfeozyKD2CEV3oCIHhShTUOVe5XKOkBlbchQ": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "EventsRuleLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "WorkflowRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Sub": "states.${AWS::Region}.amazonaws.com" + } + }, + "Action": "sts:AssumeRole" + } + ] + }, + "Policies": [ + { + "PolicyName": "dev-serverless-test-project-statemachine", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "lambda:InvokeFunction" + ], + "Resource": [ + { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + }, + { + "Fn::Sub": [ + "${functionArn}:*", + { + "functionArn": { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + } + } + ] + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogDelivery", + "logs:GetLogDelivery", + "logs:UpdateLogDelivery", + "logs:DeleteLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:DescribeResourcePolicies", + "logs:DescribeLogGroups" + ], + "Resource": "*" + } + ] + } + } + ] + } + }, + "ExpressWorkflowRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Sub": "states.${AWS::Region}.amazonaws.com" + } + }, + "Action": "sts:AssumeRole" + } + ] + }, + "Policies": [ + { + "PolicyName": "dev-serverless-test-project-statemachine", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "lambda:InvokeFunction" + ], + "Resource": [ + { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + }, + { + "Fn::Sub": [ + "${functionArn}:*", + { + "functionArn": { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + } + } + ] + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogDelivery", + "logs:GetLogDelivery", + "logs:UpdateLogDelivery", + "logs:DeleteLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:DescribeResourcePolicies", + "logs:DescribeLogGroups" + ], + "Resource": "*" + } + ] + } + } + ] + } + }, + "Workflow": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Sub": [ + "{\n \"StartAt\": \"What Next?\",\n \"States\": {\n \"What Next?\": {\n \"Type\": \"Choice\",\n \"Choices\": [\n {\n \"Variable\": \"$.destination\",\n \"StringEquals\": \"fail\",\n \"Next\": \"Fail\"\n },\n {\n \"Variable\": \"$.destination\",\n \"StringEquals\": \"timeoutTask\",\n \"Next\": \"TimeoutTask\"\n },\n {\n \"Variable\": \"$.destination\",\n \"StringEquals\": \"keepWaiting\",\n \"Next\": \"KeepWaiting\"\n }\n ],\n \"Default\": \"Succeed\"\n },\n \"TimeoutTask\": {\n \"Type\": \"Task\",\n \"TimeoutSeconds\": 1,\n \"Resource\": \"${085edd942ce144c5bd80364a6e973e4d}\",\n \"Parameters\": {\n \"sleepSeconds\": 3\n },\n \"Next\": \"Succeed\"\n },\n \"KeepWaiting\": {\n \"Type\": \"Wait\",\n \"Seconds\": 1,\n \"Next\": \"KeepWaiting\"\n },\n \"Fail\": {\n \"Type\": \"Fail\"\n },\n \"Succeed\": {\n \"Type\": \"Pass\",\n \"End\": true\n }\n }\n}", + { + "085edd942ce144c5bd80364a6e973e4d": { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + } + } + ] + }, + "RoleArn": { + "Fn::GetAtt": [ + "WorkflowRole", + "Arn" + ] + }, + "LoggingConfiguration": { + "Level": "ALL", + "IncludeExecutionData": true, + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "workflowLogGroup", + "Arn" + ] + } + } + } + ] + }, + "StateMachineName": "Workflow" + }, + "DependsOn": [ + "WorkflowRole" + ] + }, + "ExpressWorkflow": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Sub": [ + "{\n \"StartAt\": \"What Next?\",\n \"States\": {\n \"What Next?\": {\n \"Type\": \"Choice\",\n \"Choices\": [\n {\n \"Variable\": \"$.destination\",\n \"StringEquals\": \"fail\",\n \"Next\": \"Fail\"\n },\n {\n \"Variable\": \"$.destination\",\n \"StringEquals\": \"timeoutTask\",\n \"Next\": \"TimeoutTask\"\n },\n {\n \"Variable\": \"$.destination\",\n \"StringEquals\": \"keepWaiting\",\n \"Next\": \"KeepWaiting\"\n }\n ],\n \"Default\": \"Succeed\"\n },\n \"TimeoutTask\": {\n \"Type\": \"Task\",\n \"TimeoutSeconds\": 1,\n \"Resource\": \"${085edd942ce144c5bd80364a6e973e4d}\",\n \"Parameters\": {\n \"sleepSeconds\": 3\n },\n \"Next\": \"Succeed\"\n },\n \"KeepWaiting\": {\n \"Type\": \"Wait\",\n \"Seconds\": 1,\n \"Next\": \"KeepWaiting\"\n },\n \"Fail\": {\n \"Type\": \"Fail\"\n },\n \"Succeed\": {\n \"Type\": \"Pass\",\n \"End\": true\n }\n }\n}", + { + "085edd942ce144c5bd80364a6e973e4d": { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + } + } + ] + }, + "RoleArn": { + "Fn::GetAtt": [ + "ExpressWorkflowRole", + "Arn" + ] + }, + "StateMachineType": "EXPRESS", + "LoggingConfiguration": { + "Level": "ALL", + "IncludeExecutionData": true, + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "expressWorkflowLogGroup", + "Arn" + ] + } + } + } + ] + }, + "StateMachineName": "ExpressWorkflow" + }, + "DependsOn": [ + "ExpressWorkflowRole" + ] + }, + "ApiGatewayRestApi": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "Name": "dev-serverless-test-project", + "EndpointConfiguration": { + "Types": [ + "REGIONAL" + ] + }, + "Policy": "" + } + }, + "ApiGatewayResourceItem": { + "Type": "AWS::ApiGateway::Resource", + "Properties": { + "ParentId": { + "Fn::GetAtt": [ + "ApiGatewayRestApi", + "RootResourceId" + ] + }, + "PathPart": "item", + "RestApiId": { + "Ref": "ApiGatewayRestApi" + } + } + }, + "ApiGatewayResourceSubscription": { + "Type": "AWS::ApiGateway::Resource", + "Properties": { + "ParentId": { + "Fn::GetAtt": [ + "ApiGatewayRestApi", + "RootResourceId" + ] + }, + "PathPart": "subscription", + "RestApiId": { + "Ref": "ApiGatewayRestApi" + } + } + }, + "ApiGatewayMethodItemGet": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "GET", + "RequestParameters": {}, + "ResourceId": { + "Ref": "ApiGatewayResourceItem" + }, + "RestApiId": { + "Ref": "ApiGatewayRestApi" + }, + "ApiKeyRequired": false, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:", + { + "Ref": "AWS::Region" + }, + ":lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "HttpGetterLambdaFunction", + "Arn" + ] + }, + "/invocations" + ] + ] + } + }, + "MethodResponses": [] + }, + "DependsOn": [ + "HttpGetterLambdaPermissionApiGateway" + ] + }, + "ApiGatewayMethodSubscriptionPost": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "POST", + "RequestParameters": {}, + "ResourceId": { + "Ref": "ApiGatewayResourceSubscription" + }, + "RestApiId": { + "Ref": "ApiGatewayRestApi" + }, + "ApiKeyRequired": false, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:", + { + "Ref": "AWS::Region" + }, + ":lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "SubscriptionHandlerLambdaFunction", + "Arn" + ] + }, + "/invocations" + ] + ] + } + }, + "MethodResponses": [] + }, + "DependsOn": [ + "SubscriptionHandlerLambdaPermissionApiGateway" + ] + }, + "ApiGatewayDeployment1701242215363": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ApiGatewayRestApi" + }, + "StageName": "dev" + }, + "DependsOn": [ + "ApiGatewayMethodItemGet", + "ApiGatewayMethodSubscriptionPost" + ] + }, + "HttpGetterLambdaPermissionApiGateway": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "FunctionName": { + "Fn::GetAtt": [ + "HttpGetterLambdaFunction", + "Arn" + ] + }, + "Action": "lambda:InvokeFunction", + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "ApiGatewayRestApi" + }, + "/*/*" + ] + ] + } + } + }, + "SubscriptionHandlerLambdaPermissionApiGateway": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "FunctionName": { + "Fn::GetAtt": [ + "SubscriptionHandlerLambdaFunction", + "Arn" + ] + }, + "Action": "lambda:InvokeFunction", + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "ApiGatewayRestApi" + }, + "/*/*" + ] + ] + } + } + }, + "StreamProcessorEventSourceMappingKinesisStream": { + "Type": "AWS::Lambda::EventSourceMapping", + "DependsOn": [ + "IamRoleLambdaExecution" + ], + "Properties": { + "BatchSize": 10, + "Enabled": true, + "EventSourceArn": { + "Fn::GetAtt": [ + "stream", + "Arn" + ] + }, + "FunctionName": { + "Fn::GetAtt": [ + "StreamProcessorLambdaFunction", + "Arn" + ] + }, + "StartingPosition": "LATEST", + "MaximumRetryAttempts": 0 + } + }, + "ServerlesstestprojectdeveventsRulerule1EventBridgeRule": { + "Type": "AWS::Events::Rule", + "Properties": { + "EventPattern": { + "detail-type": [ + "Invoke Lambda Function" + ] + }, + "Name": "serverless-test-project-dev-eventsRule-rule-1", + "State": "ENABLED", + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "EventsRuleLambdaFunction", + "Arn" + ] + }, + "Id": "serverless-test-project-dev-eventsRule-rule-1-target", + "RetryPolicy": { + "MaximumEventAgeInSeconds": 60, + "MaximumRetryAttempts": 2 + } + } + ] + } + }, + "EventsRuleEventBridgeLambdaPermission1": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "EventsRuleLambdaFunction", + "Arn" + ] + }, + "Principal": "events.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + ":", + [ + "arn", + { + "Ref": "AWS::Partition" + }, + "events", + { + "Ref": "AWS::Region" + }, + { + "Ref": "AWS::AccountId" + }, + { + "Fn::Join": [ + "/", + [ + "rule", + "serverless-test-project-dev-eventsRule-rule-1" + ] + ] + } + ] + ] + } + } + }, + "stream": { + "Type": "AWS::Kinesis::Stream", + "Properties": { + "Name": { + "Fn::Sub": "slic-watch-test-project-stream-${AWS::AccountId}-${AWS::Region}" + }, + "ShardCount": 1 + } + }, + "bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::Sub": "slic-watch-test-project-bucket-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "dataTable": { + "Type": "AWS::DynamoDB::Table", + "DeletionPolicy": "Delete", + "Properties": { + "TableName": "MyTable", + "ProvisionedThroughput": { + "ReadCapacityUnits": 1, + "WriteCapacityUnits": 1 + }, + "AttributeDefinitions": [ + { + "AttributeName": "pk", + "AttributeType": "S" + }, + { + "AttributeName": "sk", + "AttributeType": "S" + }, + { + "AttributeName": "gsi1pk", + "AttributeType": "S" + }, + { + "AttributeName": "gsi1sk", + "AttributeType": "S" + }, + { + "AttributeName": "timestamp", + "AttributeType": "N" + } + ], + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "sk", + "KeyType": "RANGE" + } + ], + "GlobalSecondaryIndexes": [ + { + "IndexName": "GSI1", + "ProvisionedThroughput": { + "ReadCapacityUnits": 1, + "WriteCapacityUnits": 1 + }, + "KeySchema": [ + { + "AttributeName": "gsi1pk", + "KeyType": "HASH" + }, + { + "AttributeName": "gsi1sk", + "KeyType": "RANGE" + } + ], + "Projection": { + "NonKeyAttributes": [ + "address" + ], + "ProjectionType": "INCLUDE" + } + } + ], + "LocalSecondaryIndexes": [ + { + "IndexName": "LSI1", + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "timestamp", + "KeyType": "RANGE" + } + ], + "Projection": { + "NonKeyAttributes": [ + "name" + ], + "ProjectionType": "INCLUDE" + } + } + ] + } + }, + "regularQueue": { + "Type": "AWS::SQS::Queue", + "Properties": { + "QueueName": "SomeRegularQueue" + } + }, + "fifoQueue": { + "Type": "AWS::SQS::Queue", + "Properties": { + "QueueName": "SomeFifoQueue.fifo", + "FifoQueue": true + } + }, + "workflowLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "WorkflowLogs", + "RetentionInDays": 1 + } + }, + "expressWorkflowLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "ExpressWorkflowLogs", + "RetentionInDays": 1 + } + }, + "vpc": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16" + } + }, + "subnet": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": "eu-west-1a", + "CidrBlock": "10.0.16.0/20", + "VpcId": { + "Ref": "vpc" + } + } + }, + "ecsCluster": { + "Type": "AWS::ECS::Cluster", + "Properties": { + "ClusterName": "awesome-cluster" + } + }, + "ecsService": { + "Type": "AWS::ECS::Service", + "Properties": { + "ServiceName": "awesome-service", + "Cluster": { + "Ref": "ecsCluster" + }, + "DesiredCount": 0, + "LaunchType": "FARGATE", + "TaskDefinition": { + "Ref": "taskDef" + }, + "NetworkConfiguration": { + "AwsvpcConfiguration": { + "AssignPublicIp": "ENABLED", + "SecurityGroups": [], + "Subnets": [ + { + "Ref": "subnet" + } + ] + } + } + } + }, + "taskDef": { + "Type": "AWS::ECS::TaskDefinition", + "Properties": { + "RequiresCompatibilities": [ + "FARGATE" + ], + "Cpu": 256, + "Memory": 512, + "ContainerDefinitions": [ + { + "Name": "busybox", + "Image": "busybox", + "Cpu": 256, + "EntryPoint": [ + "sh", + "-c" + ], + "Memory": 512, + "Command": [ + "/bin/sh -c \"while true; do echo Hello; sleep 10; done\"" + ], + "Essential": true + } + ], + "NetworkMode": "awsvpc" + } + }, + "topic": { + "Type": "AWS::SNS::Topic", + "Properties": { + "TopicName": { + "Fn::Sub": "slic-watch-test-project-topic-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "subscriptionTest": { + "Type": "AWS::SNS::Subscription", + "Properties": { + "Endpoint": { + "Fn::Sub": "https://${ApiGatewayRestApi}.execute-api.${AWS::Region}.amazonaws.com/dev/subscription" + }, + "Protocol": "https", + "TopicArn": { + "Ref": "topic" + } + } + } + }, + "Outputs": { + "ServerlessDeploymentBucketName": { + "Value": { + "Ref": "ServerlessDeploymentBucket" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-ServerlessDeploymentBucketName" + } + }, + "HelloLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "HelloLambdaVersioncvZrQjYr4FdYsM3CaTj5TKuOJmUjyL07tfIDVXBSw4" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-HelloLambdaFunctionQualifiedArn" + } + }, + "PingLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "PingLambdaVersionSQcuddhSFqI0xKYCyuQTTJMvwrlKCB77CNQ16xyQ" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-PingLambdaFunctionQualifiedArn" + } + }, + "ThrottlerLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "ThrottlerLambdaVersion0UeWLgxZYywcyV3gGiutpyCQJEbO6Gk8zSSOP7dMEps" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-ThrottlerLambdaFunctionQualifiedArn" + } + }, + "DriveStreamLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "DriveStreamLambdaVersionsWkqlV7IV7mJdqIqQToVljMizTzZoDCso7qMazjI" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-DriveStreamLambdaFunctionQualifiedArn" + } + }, + "DriveQueueLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "DriveQueueLambdaVersionTmzx8HCxfunJ3etrLOOYLg8zG05MzRauykeVpZFz8WY" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-DriveQueueLambdaFunctionQualifiedArn" + } + }, + "DriveTableLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "DriveTableLambdaVersionkqI0DCnUasgza04mnCpqj0q5vePTOojYtyi4hxfE3ME" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-DriveTableLambdaFunctionQualifiedArn" + } + }, + "StreamProcessorLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "StreamProcessorLambdaVersion24Kwch4oq5ogXKcIDJuLGB1qAJWt8aqgW43aCjKI" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-StreamProcessorLambdaFunctionQualifiedArn" + } + }, + "HttpGetterLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "HttpGetterLambdaVersionvK2ALwc1DFqBccIyulxoBU3GveALO98nQc2xP94J8" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-HttpGetterLambdaFunctionQualifiedArn" + } + }, + "SubscriptionHandlerLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "SubscriptionHandlerLambdaVersion4kKEYaIgWsMN0XYzRQn4VAailfQcZ23kdSSOKepfB4A" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-SubscriptionHandlerLambdaFunctionQualifiedArn" + } + }, + "EventsRuleLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "EventsRuleLambdaVersionxBuN447jfeozyKD2CEV3oCIHhShTUOVe5XKOkBlbchQ" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-EventsRuleLambdaFunctionQualifiedArn" + } + }, + "WorkflowArn": { + "Description": "Current StateMachine Arn", + "Value": { + "Ref": "Workflow" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-WorkflowArn" + } + }, + "ExpressWorkflowArn": { + "Description": "Current StateMachine Arn", + "Value": { + "Ref": "ExpressWorkflow" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-ExpressWorkflowArn" + } + }, + "ServiceEndpoint": { + "Description": "URL of the service endpoint", + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "ApiGatewayRestApi" + }, + ".execute-api.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/dev" + ] + ] + }, + "Export": { + "Name": "sls-serverless-test-project-dev-ServiceEndpoint" + } + } + } +} diff --git a/serverless-test-project/tests/snapshot/serverless-test-project-snapshot.test.ts b/serverless-test-project/tests/snapshot/serverless-test-project-snapshot.test.ts new file mode 100644 index 00000000..e4a4b2c4 --- /dev/null +++ b/serverless-test-project/tests/snapshot/serverless-test-project-snapshot.test.ts @@ -0,0 +1,22 @@ +import { test } from 'tap' +import { type Template } from 'cloudform-types' + +import ServerlessPlugin from 'serverless-slic-watch-plugin/serverless-plugin' + +import inputTemplate from './fixtures/cloudformation-template-update-stack.json' +import { createMockServerless } from 'test-utils/sls-test-utils' +import { setUpSnapshotDefaults } from 'test-utils/snapshot-utils' + +const logger = {} + +const pluginUtils = { log: logger } + +test('serverless-test-project snapshot', (t) => { + setUpSnapshotDefaults(t) + const mockServerless = createMockServerless(inputTemplate as Template) + const plugin = new ServerlessPlugin(mockServerless, null, pluginUtils) + plugin.createSlicWatchResources() + const generatedTemplate = mockServerless.service.provider.compiledCloudFormationTemplate + t.matchSnapshot(generatedTemplate, 'serverless-test-project template') + t.end() +}) diff --git a/tap-snapshots/cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts.test.cjs b/tap-snapshots/cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts.test.cjs new file mode 100644 index 00000000..c00f5e6e --- /dev/null +++ b/tap-snapshots/cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts.test.cjs @@ -0,0 +1,9169 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP > cdk-test-project snapshot > ecsStack fragment 1`] = ` +{ + "Transform": "SlicWatch-v3", + "Metadata": { + "slicWatch": { + "enabled": true, + "alarms": { + "Lambda": { + "Invocations": { + "enabled": true, + "Threshold": 10 + } + }, + "SQS": { + "AgeOfOldestMessage": { + "Statistic": "Maximum", + "enabled": true, + "Threshold": 60 + }, + "InFlightMessagesPc": { + "Statistic": "Maximum", + "Threshold": 1 + } + } + } + } + }, + "Resources": { + "MyWebServerLB3B5FD3AB": { + "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", + "Properties": { + "LoadBalancerAttributes": [ + { + "Key": "deletion_protection.enabled", + "Value": "false" + } + ], + "Scheme": "internet-facing", + "SecurityGroups": [ + { + "Fn::GetAtt": [ + "MyWebServerLBSecurityGroup01B285AA", + "GroupId" + ] + } + ], + "Subnets": [ + { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99" + }, + { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A" + } + ], + "Type": "application" + }, + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableAssociation8B583A17", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTableAssociation43E5803C" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/Resource" + } + }, + "MyWebServerLBSecurityGroup01B285AA": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Automatically created Security Group for ELB CdkECSStackTestEuropeMyWebServerLBE298D4B6", + "SecurityGroupIngress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow from anyone on port 80", + "FromPort": 80, + "IpProtocol": "tcp", + "ToPort": 80 + } + ], + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/SecurityGroup/Resource" + } + }, + "MyWebServerLBSecurityGrouptoCdkECSStackTestEuropeMyWebServerServiceSecurityGroup792A2ECD807CF0A9FB": { + "Type": "AWS::EC2::SecurityGroupEgress", + "Properties": { + "GroupId": { + "Fn::GetAtt": [ + "MyWebServerLBSecurityGroup01B285AA", + "GroupId" + ] + }, + "IpProtocol": "tcp", + "Description": "Load balancer to target", + "DestinationSecurityGroupId": { + "Fn::GetAtt": [ + "MyWebServerServiceSecurityGroup6788214A", + "GroupId" + ] + }, + "FromPort": 80, + "ToPort": 80 + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/SecurityGroup/to CdkECSStackTestEuropeMyWebServerServiceSecurityGroup792A2ECD:80" + } + }, + "MyWebServerLBPublicListener03D7C493": { + "Type": "AWS::ElasticLoadBalancingV2::Listener", + "Properties": { + "DefaultActions": [ + { + "TargetGroupArn": { + "Ref": "MyWebServerLBPublicListenerECSGroup5AB9F1C3" + }, + "Type": "forward" + } + ], + "LoadBalancerArn": { + "Ref": "MyWebServerLB3B5FD3AB" + }, + "Port": 80, + "Protocol": "HTTP" + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/PublicListener/Resource" + } + }, + "MyWebServerLBPublicListenerECSGroup5AB9F1C3": { + "Type": "AWS::ElasticLoadBalancingV2::TargetGroup", + "Properties": { + "Port": 80, + "Protocol": "HTTP", + "TargetGroupAttributes": [ + { + "Key": "stickiness.enabled", + "Value": "false" + } + ], + "TargetType": "ip", + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/PublicListener/ECSGroup/Resource" + } + }, + "MyWebServerTaskDefTaskRoleB23C17AA": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/TaskRole/Resource" + } + }, + "MyWebServerTaskDef4CE825A0": { + "Type": "AWS::ECS::TaskDefinition", + "Properties": { + "ContainerDefinitions": [ + { + "Essential": true, + "Image": "amazon/amazon-ecs-sample", + "LogConfiguration": { + "LogDriver": "awslogs", + "Options": { + "awslogs-group": { + "Ref": "MyWebServerTaskDefwebLogGroupC6EE23D4" + }, + "awslogs-stream-prefix": "MyWebServer", + "awslogs-region": "eu-west-1" + } + }, + "Name": "web", + "PortMappings": [ + { + "ContainerPort": 80, + "Protocol": "tcp" + } + ] + } + ], + "Cpu": "256", + "ExecutionRoleArn": { + "Fn::GetAtt": [ + "MyWebServerTaskDefExecutionRole3C69E361", + "Arn" + ] + }, + "Family": "CdkECSStackTestEuropeMyWebServerTaskDef979012A1", + "Memory": "512", + "NetworkMode": "awsvpc", + "RequiresCompatibilities": [ + "FARGATE" + ], + "TaskRoleArn": { + "Fn::GetAtt": [ + "MyWebServerTaskDefTaskRoleB23C17AA", + "Arn" + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/Resource" + } + }, + "MyWebServerTaskDefwebLogGroupC6EE23D4": { + "Type": "AWS::Logs::LogGroup", + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/web/LogGroup/Resource" + } + }, + "MyWebServerTaskDefExecutionRole3C69E361": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/ExecutionRole/Resource" + } + }, + "MyWebServerTaskDefExecutionRoleDefaultPolicy2AEB4329": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "MyWebServerTaskDefwebLogGroupC6EE23D4", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "MyWebServerTaskDefExecutionRoleDefaultPolicy2AEB4329", + "Roles": [ + { + "Ref": "MyWebServerTaskDefExecutionRole3C69E361" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/ExecutionRole/DefaultPolicy/Resource" + } + }, + "MyWebServerService2FE7341D": { + "Type": "AWS::ECS::Service", + "Properties": { + "Cluster": { + "Ref": "EcsDefaultClusterMnL3mNNYN926A5246" + }, + "DeploymentConfiguration": { + "MaximumPercent": 200, + "MinimumHealthyPercent": 50 + }, + "EnableECSManagedTags": false, + "HealthCheckGracePeriodSeconds": 60, + "LaunchType": "FARGATE", + "LoadBalancers": [ + { + "ContainerName": "web", + "ContainerPort": 80, + "TargetGroupArn": { + "Ref": "MyWebServerLBPublicListenerECSGroup5AB9F1C3" + } + } + ], + "NetworkConfiguration": { + "AwsvpcConfiguration": { + "AssignPublicIp": "DISABLED", + "SecurityGroups": [ + { + "Fn::GetAtt": [ + "MyWebServerServiceSecurityGroup6788214A", + "GroupId" + ] + } + ], + "Subnets": [ + { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C" + }, + { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73" + } + ] + } + }, + "TaskDefinition": { + "Ref": "MyWebServerTaskDef4CE825A0" + } + }, + "DependsOn": [ + "MyWebServerLBPublicListenerECSGroup5AB9F1C3", + "MyWebServerLBPublicListener03D7C493", + "MyWebServerTaskDefTaskRoleB23C17AA" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/Service/Service" + } + }, + "MyWebServerServiceSecurityGroup6788214A": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "CdkECSStackTest-Europe/MyWebServer/Service/SecurityGroup", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + } + }, + "DependsOn": [ + "MyWebServerTaskDefTaskRoleB23C17AA" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/Service/SecurityGroup/Resource" + } + }, + "MyWebServerServiceSecurityGroupfromCdkECSStackTestEuropeMyWebServerLBSecurityGroup8823910380E44CF71E": { + "Type": "AWS::EC2::SecurityGroupIngress", + "Properties": { + "IpProtocol": "tcp", + "Description": "Load balancer to target", + "FromPort": 80, + "GroupId": { + "Fn::GetAtt": [ + "MyWebServerServiceSecurityGroup6788214A", + "GroupId" + ] + }, + "SourceSecurityGroupId": { + "Fn::GetAtt": [ + "MyWebServerLBSecurityGroup01B285AA", + "GroupId" + ] + }, + "ToPort": 80 + }, + "DependsOn": [ + "MyWebServerTaskDefTaskRoleB23C17AA" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/Service/SecurityGroup/from CdkECSStackTestEuropeMyWebServerLBSecurityGroup88239103:80" + } + }, + "EcsDefaultClusterMnL3mNNYN926A5246": { + "Type": "AWS::ECS::Cluster", + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Resource" + } + }, + "EcsDefaultClusterMnL3mNNYNVpc7788A521": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/Resource" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "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": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/Subnet" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/RouteTable" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableAssociation8B583A17": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC" + }, + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/RouteTableAssociation" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F" + } + }, + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcVPCGW2447264E" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/DefaultRoute" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1EIP8704DB2F": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/EIP" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1NATGateway5E3732C1": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99" + }, + "AllocationId": { + "Fn::GetAtt": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1EIP8704DB2F", + "AllocationId" + ] + }, + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" + } + ] + }, + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableAssociation8B583A17" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/NATGateway" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "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": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/Subnet" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/RouteTable" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTableAssociation43E5803C": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5" + }, + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/RouteTableAssociation" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F" + } + }, + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcVPCGW2447264E" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/DefaultRoute" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2EIPF0764873": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/EIP" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2NATGateway4C855E00": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A" + }, + "AllocationId": { + "Fn::GetAtt": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2EIPF0764873", + "AllocationId" + ] + }, + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" + } + ] + }, + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTableAssociation43E5803C" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/NATGateway" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "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": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/Subnet" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/RouteTable" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTableAssociation34B92275": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36" + }, + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/RouteTableAssociation" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1DefaultRouteA5ADF694": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1NATGateway5E3732C1" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/DefaultRoute" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "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": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/Subnet" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/RouteTable" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableAssociation111C622F": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591" + }, + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/RouteTableAssociation" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2DefaultRoute20CE2D89": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2NATGateway4C855E00" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/DefaultRoute" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/IGW" + } + }, + "EcsDefaultClusterMnL3mNNYNVpcVPCGW2447264E": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + }, + "InternetGatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F" + } + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/VPCGW" + } + }, + "CDKMetadata": { + "Type": "AWS::CDK::Metadata", + "Properties": { + "Analytics": "v2:deflate64:H4sIAAAAAAAA/31Ry27CMBD8Fu7GbTlUXCmlCAm1UYK4IsfZpgvBjux1EIry73WepLSqFGlnx+PsembG58/8cSIudiqT0zTDmJcRCXlinjqUIO0hF0RglOWLPM9QCkKttlokLyITSkLyJkwqCCIwBUpgkAlLKDOviBsFqrSY8fLv24YtP3/2Yx1aAtVpejw63/nJQGujXV5LRm3FQPqZEUhnkK6D5H9ilRqw9he9US2/z2V9tg+WLHCxXyJysQJq9AMKtSPYiTiDG3/jFtZqic3yg7gGq01Ql3dBa2/lRVxZYLCoXR1+vFF1CjAI2k26bkE+s68zKKpfbnnZhbIT9vQKn6iwH3nPaEUCva8j7i7Qxo4OZs6n0OTRwYqhOPMy1O17mxpo702zYIsqlunU77TV6eB7j6uq7j4c5Y5YCFY7047sccWUToAf7UPxNOf+m02OFnFqnCI8Aw/b+g3+NWTOyAIAAA==" + }, + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/CDKMetadata/Default" + } + }, + "slicWatchECSMemoryAlarmMyWebServerService2FE7341D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ECS_MemoryAlarm_\${MyWebServerService2FE7341D.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "ECS MemoryUtilization for \${MyWebServerService2FE7341D.Name} breaches 90", + {} + ] + }, + "MetricName": "MemoryUtilization", + "Namespace": "AWS/ECS", + "Dimensions": [ + { + "Name": "ServiceName", + "Value": { + "Fn::GetAtt": [ + "MyWebServerService2FE7341D", + "Name" + ] + } + }, + { + "Name": "ClusterName", + "Value": { + "Ref": "EcsDefaultClusterMnL3mNNYN926A5246" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 90 + } + }, + "slicWatchECSCPUAlarmMyWebServerService2FE7341D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ECS_CPUAlarm_\${MyWebServerService2FE7341D.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "ECS CPUUtilization for \${MyWebServerService2FE7341D.Name} breaches 90", + {} + ] + }, + "MetricName": "CPUUtilization", + "Namespace": "AWS/ECS", + "Dimensions": [ + { + "Name": "ServiceName", + "Value": { + "Fn::GetAtt": [ + "MyWebServerService2FE7341D", + "Name" + ] + } + }, + { + "Name": "ClusterName", + "Value": { + "Ref": "EcsDefaultClusterMnL3mNNYN926A5246" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 90 + } + }, + "slicWatchLoadBalancerHTTPCodeELB5XXCountAlarmMyWebServerLB3B5FD3AB": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "MetricName": "HTTPCode_ELB_5XX_Count", + "Namespace": "AWS/ApplicationELB", + "Dimensions": [ + { + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "LoadBalancerFullName" + ] + } + } + ], + "AlarmName": "LoadBalancer_HTTPCodeELB5XXCountAlarm_MyWebServerLB3B5FD3AB", + "AlarmDescription": "LoadBalancer HTTPCodeELB5XXCount Sum for MyWebServerLB3B5FD3AB breaches 0", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchLoadBalancerRejectedConnectionCountAlarmMyWebServerLB3B5FD3AB": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "MetricName": "RejectedConnectionCount", + "Namespace": "AWS/ApplicationELB", + "Dimensions": [ + { + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "LoadBalancerFullName" + ] + } + } + ], + "AlarmName": "LoadBalancer_RejectedConnectionCountAlarm_MyWebServerLB3B5FD3AB", + "AlarmDescription": "LoadBalancer RejectedConnectionCount Sum for MyWebServerLB3B5FD3AB breaches 0", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchLoadBalancerHTTPCodeTarget5XXCountAlarmMyWebServerLBPublicListenerECSGroup5AB9F1C3": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "AlarmName": "LoadBalancer_HTTPCodeTarget5XXCountAlarm_MyWebServerLBPublicListenerECSGroup5AB9F1C3", + "AlarmDescription": "LoadBalancer HTTPCode_Target_5XX_Count Sum for MyWebServerLBPublicListenerECSGroup5AB9F1C3 breaches 0", + "MetricName": "HTTPCode_Target_5XX_Count", + "Statistic": "Sum", + "Namespace": "AWS/ApplicationELB", + "Dimensions": [ + { + "Name": "TargetGroup", + "Value": { + "Fn::GetAtt": [ + "MyWebServerLBPublicListenerECSGroup5AB9F1C3", + "TargetGroupFullName" + ] + } + }, + { + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "LoadBalancerFullName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLoadBalancerUnHealthyHostCountAlarmMyWebServerLBPublicListenerECSGroup5AB9F1C3": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "AlarmName": "LoadBalancer_UnHealthyHostCountAlarm_MyWebServerLBPublicListenerECSGroup5AB9F1C3", + "AlarmDescription": "LoadBalancer UnHealthyHostCount Average for MyWebServerLBPublicListenerECSGroup5AB9F1C3 breaches 0", + "MetricName": "UnHealthyHostCount", + "Statistic": "Average", + "Namespace": "AWS/ApplicationELB", + "Dimensions": [ + { + "Name": "TargetGroup", + "Value": { + "Fn::GetAtt": [ + "MyWebServerLBPublicListenerECSGroup5AB9F1C3", + "TargetGroupFullName" + ] + } + }, + { + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "LoadBalancerFullName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchDashboard": { + "Type": "AWS::CloudWatch::Dashboard", + "Properties": { + "DashboardBody": { + "Fn::Sub": { + "start": "-PT3H", + "widgets": [ + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ECS", + "MemoryUtilization", + "ServiceName", + "\${MyWebServerService2FE7341D.Name}", + "ClusterName", + "\${EcsDefaultClusterMnL3mNNYN926A5246}", + { + "stat": "Average" + } + ], + [ + "AWS/ECS", + "CPUUtilization", + "ServiceName", + "\${MyWebServerService2FE7341D.Name}", + "ClusterName", + "\${EcsDefaultClusterMnL3mNNYN926A5246}", + { + "stat": "Average" + } + ] + ], + "title": "ECS Service \${MyWebServerService2FE7341D.Name}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApplicationELB", + "HTTPCode_ELB_5XX_Count", + "LoadBalancer", + "\${MyWebServerLB3B5FD3AB.LoadBalancerFullName}", + { + "stat": "Sum" + } + ], + [ + "AWS/ApplicationELB", + "RejectedConnectionCount", + "LoadBalancer", + "\${MyWebServerLB3B5FD3AB.LoadBalancerFullName}", + { + "stat": "Sum" + } + ] + ], + "title": "ALB \${MyWebServerLB3B5FD3AB.LoadBalancerName}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApplicationELB", + "HTTPCode_Target_5XX_Count", + "LoadBalancer", + "\${MyWebServerLB3B5FD3AB.LoadBalancerFullName}", + "TargetGroup", + "\${MyWebServerLBPublicListenerECSGroup5AB9F1C3.TargetGroupFullName}", + { + "stat": "Sum" + } + ], + [ + "AWS/ApplicationELB", + "UnHealthyHostCount", + "LoadBalancer", + "\${MyWebServerLB3B5FD3AB.LoadBalancerFullName}", + "TargetGroup", + "\${MyWebServerLBPublicListenerECSGroup5AB9F1C3.TargetGroupFullName}", + { + "stat": "Average" + } + ] + ], + "title": "Target Group \${MyWebServerLB3B5FD3AB.LoadBalancerName}/\${MyWebServerLBPublicListenerECSGroup5AB9F1C3.TargetGroupName}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 0 + } + ] + } + } + } + } + }, + "Outputs": { + "MyWebServerLoadBalancerDNSD1AFCC81": { + "Value": { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "DNSName" + ] + } + }, + "MyWebServerServiceURLB0ED50F6": { + "Value": { + "Fn::Join": [ + "", + [ + "http://", + { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "DNSName" + ] + } + ] + ] + } + } + }, + "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." + } + ] + } + } +} +` + +exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP > cdk-test-project snapshot > generalEuStack fragment 1`] = ` +{ + "Transform": "SlicWatch-v3", + "Metadata": { + "slicWatch": { + "enabled": true, + "topicArn": "arn:aws:xxxxxx:mytopic", + "alarms": { + "Lambda": { + "Invocations": { + "enabled": true, + "Threshold": 10 + } + }, + "SQS": { + "AgeOfOldestMessage": { + "Statistic": "Maximum", + "enabled": true, + "Threshold": 60 + }, + "InFlightMessagesPc": { + "Statistic": "Maximum", + "Threshold": 1 + } + } + }, + "alarmActionsConfig": { + "alarmActions": [ + { + "Ref": "MyTopic86869434" + } + ] + } + } + }, + "Resources": { + "MyTopic86869434": { + "Type": "AWS::SNS::Topic", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/MyTopic/Resource" + } + }, + "HelloHandlerServiceRole11EF7C63": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/HelloHandler/ServiceRole/Resource" + } + }, + "HelloHandler2E4FBA4D": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "HelloHandlerServiceRole11EF7C63", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "HelloHandlerServiceRole11EF7C63" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 4 + } + } + } + } + } + }, + "PingHandlerServiceRole46086423": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/PingHandler/ServiceRole/Resource" + } + }, + "PingHandler50068074": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "PingHandlerServiceRole46086423", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "PingHandlerServiceRole46086423" + ], + "Metadata": { + "slicWatch": { + "dashboard": { + "enabled": false + } + } + } + }, + "ThrottlerHandlerServiceRoleA0481DAF": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/ThrottlerHandler/ServiceRole/Resource" + } + }, + "ThrottlerHandler750A7C89": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "ThrottlerHandlerServiceRoleA0481DAF", + "Arn" + ] + }, + "Handler": "hello.handler", + "ReservedConcurrentExecutions": 0, + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "ThrottlerHandlerServiceRoleA0481DAF" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/ThrottlerHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "DriveStreamHandlerServiceRoleD2BAFDD4": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveStreamHandler/ServiceRole/Resource" + } + }, + "DriveStreamHandler62F1767B": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "DriveStreamHandlerServiceRoleD2BAFDD4", + "Arn" + ] + }, + "Handler": "stream-test-handler.handleDrive", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "DriveStreamHandlerServiceRoleD2BAFDD4" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveStreamHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "DriveQueueHandlerServiceRoleD796850A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveQueueHandler/ServiceRole/Resource" + } + }, + "DriveQueueHandler9F657A00": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "DriveQueueHandlerServiceRoleD796850A", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "DriveQueueHandlerServiceRoleD796850A" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveQueueHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "DriveTableHandlerServiceRoleDDA3FBE1": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveTableHandler/ServiceRole/Resource" + } + }, + "DriveTableHandler119966B0": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "DriveTableHandlerServiceRoleDDA3FBE1", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "DriveTableHandlerServiceRoleDDA3FBE1" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveTableHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "myapi162F20B8": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "Name": "myapi" + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Resource" + } + }, + "myapiCloudWatchRoleEB425128": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" + ] + ] + } + ] + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/CloudWatchRole/Resource" + } + }, + "myapiAccountC3A4750C": { + "Type": "AWS::ApiGateway::Account", + "Properties": { + "CloudWatchRoleArn": { + "Fn::GetAtt": [ + "myapiCloudWatchRoleEB425128", + "Arn" + ] + } + }, + "DependsOn": [ + "myapi162F20B8" + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Account" + } + }, + "myapiDeploymentB7EF8EB76dbd4bbbb18c5c458967fb55792b4830": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "Description": "Automatically created by the RestApi construct" + }, + "DependsOn": [ + "myapiproxyANYDD7FCE64", + "myapiproxyB6DF4575", + "myapiANY111D56B7" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Deployment/Resource" + } + }, + "myapiDeploymentStageprod329F21FF": { + "Type": "AWS::ApiGateway::Stage", + "Properties": { + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "DeploymentId": { + "Ref": "myapiDeploymentB7EF8EB76dbd4bbbb18c5c458967fb55792b4830" + }, + "StageName": "prod" + }, + "DependsOn": [ + "myapiAccountC3A4750C" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/DeploymentStage.prod/Resource" + } + }, + "myapiproxyB6DF4575": { + "Type": "AWS::ApiGateway::Resource", + "Properties": { + "ParentId": { + "Fn::GetAtt": [ + "myapi162F20B8", + "RootResourceId" + ] + }, + "PathPart": "{proxy+}", + "RestApiId": { + "Ref": "myapi162F20B8" + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/Resource" + } + }, + "myapiproxyANYApiPermissionCdkGeneralStackTestEuropemyapi65F2E57FANYproxyBDBDCB62": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:eu-west-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/*/*" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/ANY/ApiPermission.CdkGeneralStackTestEuropemyapi65F2E57F.ANY..{proxy+}" + } + }, + "myapiproxyANYApiPermissionTestCdkGeneralStackTestEuropemyapi65F2E57FANYproxyF17A09F1": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:eu-west-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/test-invoke-stage/*/*" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/ANY/ApiPermission.Test.CdkGeneralStackTestEuropemyapi65F2E57F.ANY..{proxy+}" + } + }, + "myapiproxyANYDD7FCE64": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "ANY", + "ResourceId": { + "Ref": "myapiproxyB6DF4575" + }, + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:eu-west-1:lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "/invocations" + ] + ] + } + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/ANY/Resource" + } + }, + "myapiANYApiPermissionCdkGeneralStackTestEuropemyapi65F2E57FANYEF4BF8F6": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:eu-west-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/*/" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/ANY/ApiPermission.CdkGeneralStackTestEuropemyapi65F2E57F.ANY.." + } + }, + "myapiANYApiPermissionTestCdkGeneralStackTestEuropemyapi65F2E57FANY3EBCCF8C": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:eu-west-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/test-invoke-stage/*/" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/ANY/ApiPermission.Test.CdkGeneralStackTestEuropemyapi65F2E57F.ANY.." + } + }, + "myapiANY111D56B7": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "ANY", + "ResourceId": { + "Fn::GetAtt": [ + "myapi162F20B8", + "RootResourceId" + ] + }, + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:eu-west-1:lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "/invocations" + ] + ] + } + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/ANY/Resource" + } + }, + "TableCD117FA1": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST" + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/Table/Resource" + } + }, + "ruleF2C1DCDC": { + "Type": "AWS::Events::Rule", + "Properties": { + "EventPattern": { + "source": [ + "aws.ec2" + ] + }, + "State": "ENABLED", + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "Arn" + ] + } + }, + "Id": "Target0", + "RetryPolicy": { + "MaximumEventAgeInSeconds": 7200, + "MaximumRetryAttempts": 2 + } + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/rule/Resource" + } + }, + "ruleAllowEventRuleCdkGeneralStackTestEuropeHelloHandlerE25EBD9DD0F76E59": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "events.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "ruleF2C1DCDC", + "Arn" + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/rule/AllowEventRuleCdkGeneralStackTestEuropeHelloHandlerE25EBD9D" + } + }, + "DeadLetterQueue9F481546": { + "Type": "AWS::SQS::Queue", + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DeadLetterQueue/Resource" + } + }, + "DeadLetterQueuePolicyB1FB890C": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "sqs:SendMessage", + "Condition": { + "ArnEquals": { + "aws:SourceArn": { + "Fn::GetAtt": [ + "ruleF2C1DCDC", + "Arn" + ] + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "events.amazonaws.com" + }, + "Resource": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "Arn" + ] + }, + "Sid": "AllowEventRuleCdkGeneralStackTestEuroperule6219EF60" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "DeadLetterQueue9F481546" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DeadLetterQueue/Policy/Resource" + } + }, + "CDKMetadata": { + "Type": "AWS::CDK::Metadata", + "Properties": { + "Analytics": "v2:deflate64:H4sIAAAAAAAA/02Q30/DIBDH/5a9M9SZmL12Gp801rr3hdKzshaoPdhsGv53D5izCeE+9z24Xxu+feC3K3HGtWy6da9qPn84ITtG0mFGg3ze20FJ9vhpEgTWC103gs/P3kinrImhJZcwaoVIXmBKaD5XtocYiDYwvD8IRHDIi2jI5zsvO3A7gcDEoFrh4CwmPr+kQhWgKwaVEvxjIaX1xrEnGHo7aSAkdeHRFG2qmoG+Wj9KSEXK0f5Mf8olceZXcF+2iVKmwJrJCG0b2ste1HmOBIHBierQfip/Gc+n8b5Jevfgk5Yh3aXtlZyuYnZDuHbG0jpit8q08dmbd4N3y/YCM7YBfsSb092W09msjqjUeqRNKA28yvYXs0P/r9UBAAA=" + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/CDKMetadata/Default" + } + }, + "slicWatchLambdaErrorsAlarmHelloHandler2E4FBA4D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${HelloHandler2E4FBA4D} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmHelloHandler2E4FBA4D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${HelloHandler2E4FBA4D} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmHelloHandler2E4FBA4D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${HelloHandler2E4FBA4D} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmHelloHandler2E4FBA4D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${HelloHandler2E4FBA4D} breaches 4", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 4 + } + }, + "slicWatchLambdaErrorsAlarmPingHandler50068074": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${PingHandler50068074}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${PingHandler50068074} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmPingHandler50068074": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${PingHandler50068074}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${PingHandler50068074} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmPingHandler50068074": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${PingHandler50068074}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${PingHandler50068074} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmPingHandler50068074": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${PingHandler50068074}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${PingHandler50068074} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmThrottlerHandler750A7C89": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${ThrottlerHandler750A7C89} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmThrottlerHandler750A7C89": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${ThrottlerHandler750A7C89} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmThrottlerHandler750A7C89": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${ThrottlerHandler750A7C89} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmThrottlerHandler750A7C89": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${ThrottlerHandler750A7C89} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmDriveStreamHandler62F1767B": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${DriveStreamHandler62F1767B} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmDriveStreamHandler62F1767B": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${DriveStreamHandler62F1767B} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmDriveStreamHandler62F1767B": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${DriveStreamHandler62F1767B} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmDriveStreamHandler62F1767B": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${DriveStreamHandler62F1767B} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmDriveQueueHandler9F657A00": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${DriveQueueHandler9F657A00}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${DriveQueueHandler9F657A00} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmDriveQueueHandler9F657A00": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${DriveQueueHandler9F657A00}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${DriveQueueHandler9F657A00} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmDriveQueueHandler9F657A00": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${DriveQueueHandler9F657A00}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${DriveQueueHandler9F657A00} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmDriveQueueHandler9F657A00": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${DriveQueueHandler9F657A00}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${DriveQueueHandler9F657A00} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmDriveTableHandler119966B0": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${DriveTableHandler119966B0}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${DriveTableHandler119966B0} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmDriveTableHandler119966B0": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${DriveTableHandler119966B0}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${DriveTableHandler119966B0} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmDriveTableHandler119966B0": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${DriveTableHandler119966B0}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${DriveTableHandler119966B0} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmDriveTableHandler119966B0": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${DriveTableHandler119966B0}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${DriveTableHandler119966B0} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchApi5XXErrorAlarmmyapi": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ApiGW_5XXError_myapi", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "API Gateway 5XXError Average for myapi breaches 0", + {} + ] + }, + "MetricName": "5XXError", + "Namespace": "AWS/ApiGateway", + "Dimensions": [ + { + "Name": "ApiName", + "Value": "myapi" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 0 + } + }, + "slicWatchApi4XXErrorAlarmmyapi": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ApiGW_4XXError_myapi", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "API Gateway 4XXError Average for myapi breaches 0.05", + {} + ] + }, + "MetricName": "4XXError", + "Namespace": "AWS/ApiGateway", + "Dimensions": [ + { + "Name": "ApiName", + "Value": "myapi" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 0.05 + } + }, + "slicWatchApiLatencyAlarmmyapi": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ApiGW_Latency_myapi", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "API Gateway Latency p99 for myapi breaches 5000", + {} + ] + }, + "MetricName": "Latency", + "Namespace": "AWS/ApiGateway", + "Dimensions": [ + { + "Name": "ApiName", + "Value": "myapi" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "ExtendedStatistic": "p99", + "Threshold": 5000 + } + }, + "slicWatchTableReadThrottleEventsAlarmTableCD117FA1": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_ReadThrottleEvents_Alarm_\${TableCD117FA1}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 10", + {} + ] + }, + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchTableWriteThrottleEventsAlarmTableCD117FA1": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_WriteThrottleEvents_Alarm_\${TableCD117FA1}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 10", + {} + ] + }, + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchTableUserErrorsAlarmTableCD117FA1": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_UserErrors_Alarm_\${TableCD117FA1}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 0", + {} + ] + }, + "MetricName": "UserErrors", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchTableSystemErrorsAlarmTableCD117FA1": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_SystemErrors_Alarm_\${TableCD117FA1}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 0", + {} + ] + }, + "MetricName": "SystemErrors", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchSQSInFlightMsgsAlarmDeadLetterQueue9F481546": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateNumberOfMessagesNotVisible_\${DeadLetterQueue9F481546.QueueName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SQS in-flight messages for \${DeadLetterQueue9F481546.QueueName} breaches 1200 (1% of the hard limit of 120000)", + {} + ] + }, + "MetricName": "ApproximateNumberOfMessagesNotVisible", + "Namespace": "AWS/SQS", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "QueueName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Maximum", + "Threshold": 1200 + } + }, + "slicWatchSQSOldestMsgAgeAlarmDeadLetterQueue9F481546": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateAgeOfOldestMessage_\${DeadLetterQueue9F481546.QueueName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SQS age of oldest message in the queue \${DeadLetterQueue9F481546.QueueName} breaches 60", + {} + ] + }, + "MetricName": "ApproximateAgeOfOldestMessage", + "Namespace": "AWS/SQS", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "QueueName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Maximum", + "Threshold": 60 + } + }, + "slicWatchSNSNumberOfNotificationsFilteredOutInvalidAttributesAlarmMyTopic86869434": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "MetricName": "NumberOfNotificationsFilteredOut-InvalidAttributes", + "Namespace": "AWS/SNS", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "MyTopic86869434", + "TopicName" + ] + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFilteredOutInvalidAttributes_Alarm_\${MyTopic86869434.TopicName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFilteredOutInvalidAttributes for \${MyTopic86869434.TopicName} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchSNSNumberOfNotificationsFailedAlarmMyTopic86869434": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "MetricName": "NumberOfNotificationsFailed", + "Namespace": "AWS/SNS", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "MyTopic86869434", + "TopicName" + ] + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFailed_Alarm_\${MyTopic86869434.TopicName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFailed for \${MyTopic86869434.TopicName} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchEventsFailedInvocationsAlarmRuleF2C1DCDC": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "MetricName": "FailedInvocations", + "Namespace": "AWS/Events", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "ruleF2C1DCDC" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "Events_FailedInvocations_Alarm_\${ruleF2C1DCDC}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge FailedInvocations for \${ruleF2C1DCDC} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchEventsThrottledRulesAlarmRuleF2C1DCDC": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "MetricName": "ThrottledRules", + "Namespace": "AWS/Events", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "ruleF2C1DCDC" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "Events_ThrottledRules_Alarm_\${ruleF2C1DCDC}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge ThrottledRules for \${ruleF2C1DCDC} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchDashboard": { + "Type": "AWS::CloudWatch::Dashboard", + "Properties": { + "DashboardBody": { + "Fn::Sub": { + "start": "-PT3H", + "widgets": [ + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApiGateway", + "5XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ] + ], + "title": "5XXError API myapi", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApiGateway", + "5XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "4XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ] + ], + "title": "4XXError API myapi", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApiGateway", + "5XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "4XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "Latency", + "ApiName", + "myapi", + { + "stat": "Average" + } + ], + [ + "AWS/ApiGateway", + "Latency", + "ApiName", + "myapi", + { + "stat": "p95" + } + ] + ], + "title": "Latency API myapi", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApiGateway", + "5XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "4XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "Latency", + "ApiName", + "myapi", + { + "stat": "Average" + } + ], + [ + "AWS/ApiGateway", + "Latency", + "ApiName", + "myapi", + { + "stat": "p95" + } + ], + [ + "AWS/ApiGateway", + "Count", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ] + ], + "title": "Count API myapi", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${TableCD117FA1}", + { + "stat": "Sum" + } + ] + ], + "title": "ReadThrottleEvents Table \${TableCD117FA1}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${TableCD117FA1}", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "WriteThrottleEvents", + "TableName", + "\${TableCD117FA1}", + { + "stat": "Sum" + } + ] + ], + "title": "WriteThrottleEvents Table \${TableCD117FA1}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Errors Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Throttles Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "Average" + } + ] + ], + "title": "Lambda Duration Average per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "p95" + } + ] + ], + "title": "Lambda Duration p95 per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 18 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda Duration Maximum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 18 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Invocations Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 18 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda ConcurrentExecutions Maximum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 24 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "NumberOfMessagesSent", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SQS", + "NumberOfMessagesReceived", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SQS", + "NumberOfMessagesDeleted", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", + { + "stat": "Sum" + } + ] + ], + "title": "Messages \${DeadLetterQueue9F481546.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 24 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "ApproximateAgeOfOldestMessage", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", + { + "stat": "Maximum" + } + ] + ], + "title": "Oldest Message age \${DeadLetterQueue9F481546.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 24 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "ApproximateNumberOfMessagesVisible", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", + { + "stat": "Maximum" + } + ] + ], + "title": "Messages in queue \${DeadLetterQueue9F481546.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 30 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SNS", + "NumberOfNotificationsFilteredOut-InvalidAttributes", + "TopicName", + "\${MyTopic86869434.TopicName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SNS", + "NumberOfNotificationsFailed", + "TopicName", + "\${MyTopic86869434.TopicName}", + { + "stat": "Sum" + } + ] + ], + "title": "SNS Topic \${MyTopic86869434.TopicName}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 30 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Events", + "FailedInvocations", + "RuleName", + "\${ruleF2C1DCDC}", + { + "stat": "Sum" + } + ], + [ + "AWS/Events", + "ThrottledRules", + "RuleName", + "\${ruleF2C1DCDC}", + { + "stat": "Sum" + } + ], + [ + "AWS/Events", + "Invocations", + "RuleName", + "\${ruleF2C1DCDC}", + { + "stat": "Sum" + } + ] + ], + "title": "EventBridge Rule \${ruleF2C1DCDC}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 30 + } + ] + } + } + } + } + }, + "Outputs": { + "myapiEndpoint8EB17201": { + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "myapi162F20B8" + }, + ".execute-api.eu-west-1.", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/" + ] + ] + } + } + }, + "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." + } + ] + } + } +} +` + +exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP > cdk-test-project snapshot > generalUsStack fragment 1`] = ` +{ + "Transform": "SlicWatch-v3", + "Metadata": { + "slicWatch": { + "enabled": true, + "topicArn": "arn:aws:xxxxxx:mytopic", + "alarms": { + "Lambda": { + "Invocations": { + "enabled": true, + "Threshold": 10 + } + }, + "SQS": { + "AgeOfOldestMessage": { + "Statistic": "Maximum", + "enabled": true, + "Threshold": 60 + }, + "InFlightMessagesPc": { + "Statistic": "Maximum", + "Threshold": 1 + } + } + }, + "alarmActionsConfig": { + "alarmActions": [ + { + "Ref": "MyTopic86869434" + } + ] + } + } + }, + "Resources": { + "MyTopic86869434": { + "Type": "AWS::SNS::Topic", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/MyTopic/Resource" + } + }, + "HelloHandlerServiceRole11EF7C63": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/HelloHandler/ServiceRole/Resource" + } + }, + "HelloHandler2E4FBA4D": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "HelloHandlerServiceRole11EF7C63", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "HelloHandlerServiceRole11EF7C63" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 4 + } + } + } + } + } + }, + "PingHandlerServiceRole46086423": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/PingHandler/ServiceRole/Resource" + } + }, + "PingHandler50068074": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "PingHandlerServiceRole46086423", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "PingHandlerServiceRole46086423" + ], + "Metadata": { + "slicWatch": { + "dashboard": { + "enabled": false + } + } + } + }, + "ThrottlerHandlerServiceRoleA0481DAF": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/ThrottlerHandler/ServiceRole/Resource" + } + }, + "ThrottlerHandler750A7C89": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "ThrottlerHandlerServiceRoleA0481DAF", + "Arn" + ] + }, + "Handler": "hello.handler", + "ReservedConcurrentExecutions": 0, + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "ThrottlerHandlerServiceRoleA0481DAF" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/ThrottlerHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "DriveStreamHandlerServiceRoleD2BAFDD4": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveStreamHandler/ServiceRole/Resource" + } + }, + "DriveStreamHandler62F1767B": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "DriveStreamHandlerServiceRoleD2BAFDD4", + "Arn" + ] + }, + "Handler": "stream-test-handler.handleDrive", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "DriveStreamHandlerServiceRoleD2BAFDD4" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveStreamHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "DriveQueueHandlerServiceRoleD796850A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveQueueHandler/ServiceRole/Resource" + } + }, + "DriveQueueHandler9F657A00": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "DriveQueueHandlerServiceRoleD796850A", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "DriveQueueHandlerServiceRoleD796850A" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveQueueHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "DriveTableHandlerServiceRoleDDA3FBE1": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveTableHandler/ServiceRole/Resource" + } + }, + "DriveTableHandler119966B0": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "DriveTableHandlerServiceRoleDDA3FBE1", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "DriveTableHandlerServiceRoleDDA3FBE1" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveTableHandler/Resource", + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:is-bundled": false, + "aws:asset:property": "Code" + } + }, + "myapi162F20B8": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "Name": "myapi" + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Resource" + } + }, + "myapiCloudWatchRoleEB425128": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" + ] + ] + } + ] + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/CloudWatchRole/Resource" + } + }, + "myapiAccountC3A4750C": { + "Type": "AWS::ApiGateway::Account", + "Properties": { + "CloudWatchRoleArn": { + "Fn::GetAtt": [ + "myapiCloudWatchRoleEB425128", + "Arn" + ] + } + }, + "DependsOn": [ + "myapi162F20B8" + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Account" + } + }, + "myapiDeploymentB7EF8EB7fea2aa51ab5416f81a0b318c3a85d817": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "Description": "Automatically created by the RestApi construct" + }, + "DependsOn": [ + "myapiproxyANYDD7FCE64", + "myapiproxyB6DF4575", + "myapiANY111D56B7" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Deployment/Resource" + } + }, + "myapiDeploymentStageprod329F21FF": { + "Type": "AWS::ApiGateway::Stage", + "Properties": { + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "DeploymentId": { + "Ref": "myapiDeploymentB7EF8EB7fea2aa51ab5416f81a0b318c3a85d817" + }, + "StageName": "prod" + }, + "DependsOn": [ + "myapiAccountC3A4750C" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/DeploymentStage.prod/Resource" + } + }, + "myapiproxyB6DF4575": { + "Type": "AWS::ApiGateway::Resource", + "Properties": { + "ParentId": { + "Fn::GetAtt": [ + "myapi162F20B8", + "RootResourceId" + ] + }, + "PathPart": "{proxy+}", + "RestApiId": { + "Ref": "myapi162F20B8" + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/Resource" + } + }, + "myapiproxyANYApiPermissionCdkGeneralStackTestUSmyapi9E6CC024ANYproxy61FC0812": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/*/*" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/ANY/ApiPermission.CdkGeneralStackTestUSmyapi9E6CC024.ANY..{proxy+}" + } + }, + "myapiproxyANYApiPermissionTestCdkGeneralStackTestUSmyapi9E6CC024ANYproxy352B4E19": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/test-invoke-stage/*/*" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/ANY/ApiPermission.Test.CdkGeneralStackTestUSmyapi9E6CC024.ANY..{proxy+}" + } + }, + "myapiproxyANYDD7FCE64": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "ANY", + "ResourceId": { + "Ref": "myapiproxyB6DF4575" + }, + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:us-east-1:lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "/invocations" + ] + ] + } + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/ANY/Resource" + } + }, + "myapiANYApiPermissionCdkGeneralStackTestUSmyapi9E6CC024ANY52E5EFEE": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/*/" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/ANY/ApiPermission.CdkGeneralStackTestUSmyapi9E6CC024.ANY.." + } + }, + "myapiANYApiPermissionTestCdkGeneralStackTestUSmyapi9E6CC024ANY1136CBF8": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/test-invoke-stage/*/" + ] + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/ANY/ApiPermission.Test.CdkGeneralStackTestUSmyapi9E6CC024.ANY.." + } + }, + "myapiANY111D56B7": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "ANY", + "ResourceId": { + "Fn::GetAtt": [ + "myapi162F20B8", + "RootResourceId" + ] + }, + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:us-east-1:lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "/invocations" + ] + ] + } + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/ANY/Resource" + } + }, + "TableCD117FA1": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST" + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/Table/Resource" + } + }, + "ruleF2C1DCDC": { + "Type": "AWS::Events::Rule", + "Properties": { + "EventPattern": { + "source": [ + "aws.ec2" + ] + }, + "State": "ENABLED", + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "Arn" + ] + } + }, + "Id": "Target0", + "RetryPolicy": { + "MaximumEventAgeInSeconds": 7200, + "MaximumRetryAttempts": 2 + } + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/rule/Resource" + } + }, + "ruleAllowEventRuleCdkGeneralStackTestUSHelloHandlerC75B8B54C6DD839C": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "Principal": "events.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "ruleF2C1DCDC", + "Arn" + ] + } + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/rule/AllowEventRuleCdkGeneralStackTestUSHelloHandlerC75B8B54" + } + }, + "DeadLetterQueue9F481546": { + "Type": "AWS::SQS::Queue", + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DeadLetterQueue/Resource" + } + }, + "DeadLetterQueuePolicyB1FB890C": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "sqs:SendMessage", + "Condition": { + "ArnEquals": { + "aws:SourceArn": { + "Fn::GetAtt": [ + "ruleF2C1DCDC", + "Arn" + ] + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "events.amazonaws.com" + }, + "Resource": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "Arn" + ] + }, + "Sid": "AllowEventRuleCdkGeneralStackTestUSruleB0D09E87" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "DeadLetterQueue9F481546" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DeadLetterQueue/Policy/Resource" + } + }, + "CDKMetadata": { + "Type": "AWS::CDK::Metadata", + "Properties": { + "Analytics": "v2:deflate64:H4sIAAAAAAAA/02Q30/DIBDH/5a9M9SZmL12Gp801rr3hdKzshaoPdhsGv53D5izCeE+9z24Xxu+feC3K3HGtWy6da9qPn84ITtG0mFGg3ze20FJ9vhpEgTWC103gs/P3kinrImhJZcwaoVIXmBKaD5XtocYiDYwvD8IRHDIi2jI5zsvO3A7gcDEoFrh4CwmPr+kQhWgKwaVEvxjIaX1xrEnGHo7aSAkdeHRFG2qmoG+Wj9KSEXK0f5Mf8olceZXcF+2iVKmwJrJCG0b2ste1HmOBIHBierQfip/Gc+n8b5Jevfgk5Yh3aXtlZyuYnZDuHbG0jpit8q08dmbd4N3y/YCM7YBfsSb092W09msjqjUeqRNKA28yvYXs0P/r9UBAAA=" + }, + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/CDKMetadata/Default" + } + }, + "slicWatchLambdaErrorsAlarmHelloHandler2E4FBA4D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${HelloHandler2E4FBA4D} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmHelloHandler2E4FBA4D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${HelloHandler2E4FBA4D} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmHelloHandler2E4FBA4D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${HelloHandler2E4FBA4D} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmHelloHandler2E4FBA4D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${HelloHandler2E4FBA4D} breaches 4", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 4 + } + }, + "slicWatchLambdaErrorsAlarmPingHandler50068074": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${PingHandler50068074}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${PingHandler50068074} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmPingHandler50068074": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${PingHandler50068074}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${PingHandler50068074} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmPingHandler50068074": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${PingHandler50068074}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${PingHandler50068074} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmPingHandler50068074": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${PingHandler50068074}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${PingHandler50068074} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmThrottlerHandler750A7C89": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${ThrottlerHandler750A7C89} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmThrottlerHandler750A7C89": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${ThrottlerHandler750A7C89} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmThrottlerHandler750A7C89": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${ThrottlerHandler750A7C89} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmThrottlerHandler750A7C89": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${ThrottlerHandler750A7C89} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmDriveStreamHandler62F1767B": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${DriveStreamHandler62F1767B} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmDriveStreamHandler62F1767B": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${DriveStreamHandler62F1767B} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmDriveStreamHandler62F1767B": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${DriveStreamHandler62F1767B} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmDriveStreamHandler62F1767B": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${DriveStreamHandler62F1767B} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmDriveQueueHandler9F657A00": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${DriveQueueHandler9F657A00}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${DriveQueueHandler9F657A00} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmDriveQueueHandler9F657A00": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${DriveQueueHandler9F657A00}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${DriveQueueHandler9F657A00} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmDriveQueueHandler9F657A00": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${DriveQueueHandler9F657A00}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${DriveQueueHandler9F657A00} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmDriveQueueHandler9F657A00": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${DriveQueueHandler9F657A00}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${DriveQueueHandler9F657A00} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmDriveTableHandler119966B0": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${DriveTableHandler119966B0}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${DriveTableHandler119966B0} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmDriveTableHandler119966B0": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${DriveTableHandler119966B0}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${DriveTableHandler119966B0} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmDriveTableHandler119966B0": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${DriveTableHandler119966B0}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${DriveTableHandler119966B0} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmDriveTableHandler119966B0": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${DriveTableHandler119966B0}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${DriveTableHandler119966B0} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchApi5XXErrorAlarmmyapi": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ApiGW_5XXError_myapi", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "API Gateway 5XXError Average for myapi breaches 0", + {} + ] + }, + "MetricName": "5XXError", + "Namespace": "AWS/ApiGateway", + "Dimensions": [ + { + "Name": "ApiName", + "Value": "myapi" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 0 + } + }, + "slicWatchApi4XXErrorAlarmmyapi": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ApiGW_4XXError_myapi", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "API Gateway 4XXError Average for myapi breaches 0.05", + {} + ] + }, + "MetricName": "4XXError", + "Namespace": "AWS/ApiGateway", + "Dimensions": [ + { + "Name": "ApiName", + "Value": "myapi" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 0.05 + } + }, + "slicWatchApiLatencyAlarmmyapi": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ApiGW_Latency_myapi", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "API Gateway Latency p99 for myapi breaches 5000", + {} + ] + }, + "MetricName": "Latency", + "Namespace": "AWS/ApiGateway", + "Dimensions": [ + { + "Name": "ApiName", + "Value": "myapi" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "ExtendedStatistic": "p99", + "Threshold": 5000 + } + }, + "slicWatchTableReadThrottleEventsAlarmTableCD117FA1": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_ReadThrottleEvents_Alarm_\${TableCD117FA1}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 10", + {} + ] + }, + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchTableWriteThrottleEventsAlarmTableCD117FA1": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_WriteThrottleEvents_Alarm_\${TableCD117FA1}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 10", + {} + ] + }, + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchTableUserErrorsAlarmTableCD117FA1": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_UserErrors_Alarm_\${TableCD117FA1}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 0", + {} + ] + }, + "MetricName": "UserErrors", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchTableSystemErrorsAlarmTableCD117FA1": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_SystemErrors_Alarm_\${TableCD117FA1}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 0", + {} + ] + }, + "MetricName": "SystemErrors", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchSQSInFlightMsgsAlarmDeadLetterQueue9F481546": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateNumberOfMessagesNotVisible_\${DeadLetterQueue9F481546.QueueName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SQS in-flight messages for \${DeadLetterQueue9F481546.QueueName} breaches 1200 (1% of the hard limit of 120000)", + {} + ] + }, + "MetricName": "ApproximateNumberOfMessagesNotVisible", + "Namespace": "AWS/SQS", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "QueueName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Maximum", + "Threshold": 1200 + } + }, + "slicWatchSQSOldestMsgAgeAlarmDeadLetterQueue9F481546": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateAgeOfOldestMessage_\${DeadLetterQueue9F481546.QueueName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SQS age of oldest message in the queue \${DeadLetterQueue9F481546.QueueName} breaches 60", + {} + ] + }, + "MetricName": "ApproximateAgeOfOldestMessage", + "Namespace": "AWS/SQS", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "QueueName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Maximum", + "Threshold": 60 + } + }, + "slicWatchSNSNumberOfNotificationsFilteredOutInvalidAttributesAlarmMyTopic86869434": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "MetricName": "NumberOfNotificationsFilteredOut-InvalidAttributes", + "Namespace": "AWS/SNS", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "MyTopic86869434", + "TopicName" + ] + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFilteredOutInvalidAttributes_Alarm_\${MyTopic86869434.TopicName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFilteredOutInvalidAttributes for \${MyTopic86869434.TopicName} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchSNSNumberOfNotificationsFailedAlarmMyTopic86869434": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "MetricName": "NumberOfNotificationsFailed", + "Namespace": "AWS/SNS", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "MyTopic86869434", + "TopicName" + ] + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFailed_Alarm_\${MyTopic86869434.TopicName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFailed for \${MyTopic86869434.TopicName} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchEventsFailedInvocationsAlarmRuleF2C1DCDC": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "MetricName": "FailedInvocations", + "Namespace": "AWS/Events", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "ruleF2C1DCDC" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "Events_FailedInvocations_Alarm_\${ruleF2C1DCDC}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge FailedInvocations for \${ruleF2C1DCDC} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchEventsThrottledRulesAlarmRuleF2C1DCDC": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "OKActions": [], + "MetricName": "ThrottledRules", + "Namespace": "AWS/Events", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "ruleF2C1DCDC" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "Events_ThrottledRules_Alarm_\${ruleF2C1DCDC}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge ThrottledRules for \${ruleF2C1DCDC} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchDashboard": { + "Type": "AWS::CloudWatch::Dashboard", + "Properties": { + "DashboardBody": { + "Fn::Sub": { + "start": "-PT3H", + "widgets": [ + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApiGateway", + "5XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ] + ], + "title": "5XXError API myapi", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApiGateway", + "5XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "4XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ] + ], + "title": "4XXError API myapi", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApiGateway", + "5XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "4XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "Latency", + "ApiName", + "myapi", + { + "stat": "Average" + } + ], + [ + "AWS/ApiGateway", + "Latency", + "ApiName", + "myapi", + { + "stat": "p95" + } + ] + ], + "title": "Latency API myapi", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApiGateway", + "5XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "4XXError", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "Latency", + "ApiName", + "myapi", + { + "stat": "Average" + } + ], + [ + "AWS/ApiGateway", + "Latency", + "ApiName", + "myapi", + { + "stat": "p95" + } + ], + [ + "AWS/ApiGateway", + "Count", + "ApiName", + "myapi", + { + "stat": "Sum" + } + ] + ], + "title": "Count API myapi", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${TableCD117FA1}", + { + "stat": "Sum" + } + ] + ], + "title": "ReadThrottleEvents Table \${TableCD117FA1}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${TableCD117FA1}", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "WriteThrottleEvents", + "TableName", + "\${TableCD117FA1}", + { + "stat": "Sum" + } + ] + ], + "title": "WriteThrottleEvents Table \${TableCD117FA1}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Errors Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Throttles Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "Average" + } + ] + ], + "title": "Lambda Duration Average per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "p95" + } + ] + ], + "title": "Lambda Duration p95 per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 18 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda Duration Maximum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 18 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Invocations Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 18 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${ThrottlerHandler750A7C89}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${DriveStreamHandler62F1767B}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${DriveQueueHandler9F657A00}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${DriveTableHandler119966B0}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda ConcurrentExecutions Maximum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 24 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "NumberOfMessagesSent", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SQS", + "NumberOfMessagesReceived", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SQS", + "NumberOfMessagesDeleted", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", + { + "stat": "Sum" + } + ] + ], + "title": "Messages \${DeadLetterQueue9F481546.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 24 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "ApproximateAgeOfOldestMessage", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", + { + "stat": "Maximum" + } + ] + ], + "title": "Oldest Message age \${DeadLetterQueue9F481546.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 24 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "ApproximateNumberOfMessagesVisible", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", + { + "stat": "Maximum" + } + ] + ], + "title": "Messages in queue \${DeadLetterQueue9F481546.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 30 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SNS", + "NumberOfNotificationsFilteredOut-InvalidAttributes", + "TopicName", + "\${MyTopic86869434.TopicName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SNS", + "NumberOfNotificationsFailed", + "TopicName", + "\${MyTopic86869434.TopicName}", + { + "stat": "Sum" + } + ] + ], + "title": "SNS Topic \${MyTopic86869434.TopicName}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 30 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Events", + "FailedInvocations", + "RuleName", + "\${ruleF2C1DCDC}", + { + "stat": "Sum" + } + ], + [ + "AWS/Events", + "ThrottledRules", + "RuleName", + "\${ruleF2C1DCDC}", + { + "stat": "Sum" + } + ], + [ + "AWS/Events", + "Invocations", + "RuleName", + "\${ruleF2C1DCDC}", + { + "stat": "Sum" + } + ] + ], + "title": "EventBridge Rule \${ruleF2C1DCDC}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 30 + } + ] + } + } + } + } + }, + "Outputs": { + "myapiEndpoint8EB17201": { + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "myapi162F20B8" + }, + ".execute-api.us-east-1.", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/" + ] + ] + } + } + }, + "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." + } + ] + } + } +} +` + +exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP > cdk-test-project snapshot > stepFunctionStack fragment 1`] = ` +{ + "Transform": "SlicWatch-v3", + "Metadata": { + "slicWatch": { + "enabled": true, + "alarms": { + "Lambda": { + "Invocations": { + "enabled": true, + "Threshold": 10 + } + }, + "SQS": { + "AgeOfOldestMessage": { + "Statistic": "Maximum", + "enabled": true, + "Threshold": 60 + }, + "InFlightMessagesPc": { + "Statistic": "Maximum", + "Threshold": 1 + } + } + }, + "topicArn": { + "Ref": "MyTopic86869434" + } + } + }, + "Resources": { + "MyTopic86869434": { + "Type": "AWS::SNS::Topic", + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/MyTopic/Resource" + } + }, + "HelloHandlerServiceRole11EF7C63": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/HelloHandler/ServiceRole/Resource" + } + }, + "HelloHandler2E4FBA4D": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Role": { + "Fn::GetAtt": [ + "HelloHandlerServiceRole11EF7C63", + "Arn" + ] + }, + "Handler": "hello.handler", + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "HelloHandlerServiceRole11EF7C63" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 4 + } + } + } + } + } + }, + "StateMachineRoleB840431D": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.eu-west-1.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + }, + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/StateMachine/Role/Resource" + } + }, + "StateMachineRoleDefaultPolicyDF1E6607": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "StateMachineRoleDefaultPolicyDF1E6607", + "Roles": [ + { + "Ref": "StateMachineRoleB840431D" + } + ] + }, + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/StateMachine/Role/DefaultPolicy/Resource" + } + }, + "StateMachine2E01A3A5": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "RoleArn": { + "Fn::GetAtt": [ + "StateMachineRoleB840431D", + "Arn" + ] + }, + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\\"StartAt\\":\\"Submit Job\\",\\"States\\":{\\"Submit Job\\":{\\"Next\\":\\"Wait X Seconds\\",\\"Retry\\":[{\\"ErrorEquals\\":[\\"Lambda.ServiceException\\",\\"Lambda.AWSLambdaException\\",\\"Lambda.SdkClientException\\"],\\"IntervalSeconds\\":2,\\"MaxAttempts\\":6,\\"BackoffRate\\":2}],\\"Type\\":\\"Task\\",\\"OutputPath\\":\\"$.Payload\\",\\"Resource\\":\\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\\",\\"Parameters\\":{\\"FunctionName\\":\\"", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "\\",\\"Payload.$\\":\\"$\\"}},\\"Wait X Seconds\\":{\\"Type\\":\\"Wait\\",\\"SecondsPath\\":\\"$.waitSeconds\\",\\"Next\\":\\"Get Job Status\\"},\\"Get Job Status\\":{\\"Next\\":\\"Job Complete?\\",\\"Retry\\":[{\\"ErrorEquals\\":[\\"Lambda.ServiceException\\",\\"Lambda.AWSLambdaException\\",\\"Lambda.SdkClientException\\"],\\"IntervalSeconds\\":2,\\"MaxAttempts\\":6,\\"BackoffRate\\":2}],\\"Type\\":\\"Task\\",\\"InputPath\\":\\"$.guid\\",\\"OutputPath\\":\\"$.Payload\\",\\"Resource\\":\\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\\",\\"Parameters\\":{\\"FunctionName\\":\\"", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "\\",\\"Payload.$\\":\\"$\\"}},\\"Job Complete?\\":{\\"Type\\":\\"Choice\\",\\"Choices\\":[{\\"Variable\\":\\"$.status\\",\\"StringEquals\\":\\"FAILED\\",\\"Next\\":\\"Job Failed\\"},{\\"Variable\\":\\"$.status\\",\\"StringEquals\\":\\"SUCCEEDED\\",\\"Next\\":\\"Get Final Job Status\\"}],\\"Default\\":\\"Wait X Seconds\\"},\\"Job Failed\\":{\\"Type\\":\\"Fail\\",\\"Error\\":\\"DescribeJob returned FAILED\\",\\"Cause\\":\\"AWS Batch Job Failed\\"},\\"Get Final Job Status\\":{\\"End\\":true,\\"Retry\\":[{\\"ErrorEquals\\":[\\"Lambda.ServiceException\\",\\"Lambda.AWSLambdaException\\",\\"Lambda.SdkClientException\\"],\\"IntervalSeconds\\":2,\\"MaxAttempts\\":6,\\"BackoffRate\\":2}],\\"Type\\":\\"Task\\",\\"InputPath\\":\\"$.guid\\",\\"OutputPath\\":\\"$.Payload\\",\\"Resource\\":\\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\\",\\"Parameters\\":{\\"FunctionName\\":\\"", + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "\\",\\"Payload.$\\":\\"$\\"}}},\\"TimeoutSeconds\\":300}" + ] + ] + } + }, + "DependsOn": [ + "StateMachineRoleDefaultPolicyDF1E6607", + "StateMachineRoleB840431D" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete", + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/StateMachine/Resource" + } + }, + "CDKMetadata": { + "Type": "AWS::CDK::Metadata", + "Properties": { + "Analytics": "v2:deflate64:H4sIAAAAAAAA/11P0UoDQQz8lr7nolaQvtpCoaAgp+Djke6lbbp7u6XZq8iy/+7etoIIgZnJhEwyx8UT3s/oSxvT28bJFtN7JGOhtLqkXjF9hJMYWO18JRkcDdueMK1Hb6IEP1m/PIPQgKkNjqd2xbfgxHxP8soy6GNHqhwVnycoGpejsRyXpAwa+bS77dMuklrFl5q58Zdg/w1g+iSJsCZxsDoEMQzlgcivZA7i6xV/dc7QsobxXOZqeDH34vf12puRwYee8ah3l4cFlprPjirSnEcfZWBsr/gDsE52pTwBAAA=" + }, + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/CDKMetadata/Default" + } + }, + "slicWatchLambdaErrorsAlarmHelloHandler2E4FBA4D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${HelloHandler2E4FBA4D} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmHelloHandler2E4FBA4D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${HelloHandler2E4FBA4D} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmHelloHandler2E4FBA4D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${HelloHandler2E4FBA4D} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmHelloHandler2E4FBA4D": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${HelloHandler2E4FBA4D} breaches 4", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 4 + } + }, + "slicWatchStatesExecutionThrottledAlarmStateMachine2E01A3A5": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "StateMachine2E01A3A5" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionThrottledAlarm_\${StateMachine2E01A3A5.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionThrottled Sum for \${StateMachine2E01A3A5.Name} breaches 0", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchStatesExecutionsFailedAlarmStateMachine2E01A3A5": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "StateMachine2E01A3A5" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionsFailedAlarm_\${StateMachine2E01A3A5.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionsFailed Sum for \${StateMachine2E01A3A5.Name} breaches 0", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchStatesExecutionsTimedOutAlarmStateMachine2E01A3A5": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "MetricName": "ExecutionsTimedOut", + "Namespace": "AWS/States", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "StateMachine2E01A3A5" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionsTimedOutAlarm_\${StateMachine2E01A3A5.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionsTimedOut Sum for \${StateMachine2E01A3A5.Name} breaches 0", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchSNSNumberOfNotificationsFilteredOutInvalidAttributesAlarmMyTopic86869434": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "MetricName": "NumberOfNotificationsFilteredOut-InvalidAttributes", + "Namespace": "AWS/SNS", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "MyTopic86869434", + "TopicName" + ] + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFilteredOutInvalidAttributes_Alarm_\${MyTopic86869434.TopicName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFilteredOutInvalidAttributes for \${MyTopic86869434.TopicName} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchSNSNumberOfNotificationsFailedAlarmMyTopic86869434": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "OKActions": [], + "MetricName": "NumberOfNotificationsFailed", + "Namespace": "AWS/SNS", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "MyTopic86869434", + "TopicName" + ] + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFailed_Alarm_\${MyTopic86869434.TopicName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFailed for \${MyTopic86869434.TopicName} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchDashboard": { + "Type": "AWS::CloudWatch::Dashboard", + "Properties": { + "DashboardBody": { + "Fn::Sub": { + "start": "-PT3H", + "widgets": [ + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/States", + "ExecutionsFailed", + "StateMachineArn", + "\${StateMachine2E01A3A5}", + { + "stat": "Sum" + } + ], + [ + "AWS/States", + "ExecutionThrottled", + "StateMachineArn", + "\${StateMachine2E01A3A5}", + { + "stat": "Sum" + } + ], + [ + "AWS/States", + "ExecutionsTimedOut", + "StateMachineArn", + "\${StateMachine2E01A3A5}", + { + "stat": "Sum" + } + ] + ], + "title": "\${StateMachine2E01A3A5.Name} Step Function Executions", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Errors Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Throttles Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Average" + } + ] + ], + "title": "Lambda Duration Average per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "p95" + } + ] + ], + "title": "Lambda Duration p95 per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda Duration Maximum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Invocations Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${HelloHandler2E4FBA4D}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda ConcurrentExecutions Maximum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SNS", + "NumberOfNotificationsFilteredOut-InvalidAttributes", + "TopicName", + "\${MyTopic86869434.TopicName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SNS", + "NumberOfNotificationsFailed", + "TopicName", + "\${MyTopic86869434.TopicName}", + { + "stat": "Sum" + } + ] + ], + "title": "SNS Topic \${MyTopic86869434.TopicName}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 12 + } + ] + } + } + } + } + }, + "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." + } + ] + } + } +} +` diff --git a/tap-snapshots/sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts.test.cjs b/tap-snapshots/sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts.test.cjs new file mode 100644 index 00000000..44a5fe0e --- /dev/null +++ b/tap-snapshots/sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts.test.cjs @@ -0,0 +1,5158 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP > sam-test-project snapshot > fragment 1`] = ` +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "sam-test-project", + "Metadata": { + "slicWatch": { + "enabled": true, + "alarmActionsConfig": { + "alarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "okActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "actionsEnabled": true + }, + "alarms": { + "Lambda": { + "Invocations": { + "enabled": true, + "Threshold": 10 + } + }, + "SQS": { + "AgeOfOldestMessage": { + "Statistic": "Maximum", + "enabled": true, + "Threshold": 60 + }, + "InFlightMessagesPc": { + "Statistic": "Maximum", + "Threshold": 1 + } + } + } + } + }, + "Resources": { + "MonitoringTopic": { + "Type": "AWS::SNS::Topic", + "Properties": { + "TopicName": "SS-Alarm-Topic3" + }, + "Metadata": { + "SamResourceId": "MonitoringTopic" + } + }, + "stream": { + "Type": "AWS::Kinesis::Stream", + "Properties": { + "ShardCount": 1 + }, + "Metadata": { + "SamResourceId": "stream" + } + }, + "regularQueue": { + "Type": "AWS::SQS::Queue", + "Metadata": { + "SamResourceId": "regularQueue" + } + }, + "fifoQueue": { + "Type": "AWS::SQS::Queue", + "Properties": { + "FifoQueue": true + }, + "Metadata": { + "SamResourceId": "fifoQueue" + } + }, + "vpc": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16" + }, + "Metadata": { + "SamResourceId": "vpc" + } + }, + "subnet": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": { + "Ref": "AWS::Region" + } + } + ] + }, + "CidrBlock": "10.0.16.0/20", + "VpcId": { + "Ref": "vpc" + } + }, + "Metadata": { + "SamResourceId": "subnet" + } + }, + "ecsCluster": { + "Type": "AWS::ECS::Cluster", + "Metadata": { + "SamResourceId": "ecsCluster" + } + }, + "ecsService": { + "Type": "AWS::ECS::Service", + "Properties": { + "Cluster": { + "Ref": "ecsCluster" + }, + "DesiredCount": 0, + "LaunchType": "FARGATE", + "TaskDefinition": { + "Ref": "taskDef" + }, + "NetworkConfiguration": { + "AwsvpcConfiguration": { + "AssignPublicIp": "ENABLED", + "SecurityGroups": [], + "Subnets": [ + { + "Ref": "subnet" + } + ] + } + } + }, + "Metadata": { + "SamResourceId": "ecsService" + } + }, + "taskDef": { + "Type": "AWS::ECS::TaskDefinition", + "Properties": { + "RequiresCompatibilities": [ + "FARGATE" + ], + "Cpu": 256, + "Memory": 512, + "ContainerDefinitions": [ + { + "Name": "busybox", + "Image": "busybox", + "Cpu": 256, + "EntryPoint": [ + "sh", + "-c" + ], + "Memory": 512, + "Command": [ + "/bin/sh -c \\"while true; do echo Hello; sleep 10; done\\"" + ], + "Essential": true + } + ], + "NetworkMode": "awsvpc" + }, + "Metadata": { + "SamResourceId": "taskDef" + } + }, + "dataTable": { + "Type": "AWS::DynamoDB::Table", + "DeletionPolicy": "Delete", + "Properties": { + "ProvisionedThroughput": { + "ReadCapacityUnits": 1, + "WriteCapacityUnits": 1 + }, + "AttributeDefinitions": [ + { + "AttributeName": "pk", + "AttributeType": "S" + }, + { + "AttributeName": "sk", + "AttributeType": "S" + }, + { + "AttributeName": "gsi1pk", + "AttributeType": "S" + }, + { + "AttributeName": "gsi1sk", + "AttributeType": "S" + }, + { + "AttributeName": "timestamp", + "AttributeType": "N" + } + ], + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "sk", + "KeyType": "RANGE" + } + ], + "GlobalSecondaryIndexes": [ + { + "IndexName": "GSI1", + "ProvisionedThroughput": { + "ReadCapacityUnits": 1, + "WriteCapacityUnits": 1 + }, + "KeySchema": [ + { + "AttributeName": "gsi1pk", + "KeyType": "HASH" + }, + { + "AttributeName": "gsi1sk", + "KeyType": "RANGE" + } + ], + "Projection": { + "NonKeyAttributes": [ + "address" + ], + "ProjectionType": "INCLUDE" + } + } + ], + "LocalSecondaryIndexes": [ + { + "IndexName": "LSI1", + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "timestamp", + "KeyType": "RANGE" + } + ], + "Projection": { + "NonKeyAttributes": [ + "name" + ], + "ProjectionType": "INCLUDE" + } + } + ] + }, + "Metadata": { + "SamResourceId": "dataTable" + } + }, + "hello": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "hello", + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 2 + } + } + } + } + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "Role": { + "Fn::GetAtt": [ + "helloRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "helloRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "ping": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "ping", + "slicWatch": { + "dashboard": { + "enabled": false + } + } + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "Role": { + "Fn::GetAtt": [ + "pingRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "pingRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "throttler": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "throttler" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "Role": { + "Fn::GetAtt": [ + "throttlerRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ], + "ReservedConcurrentExecutions": 0 + } + }, + "throttlerRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "driveStream": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "driveStream" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "stream-test-handler.handleDrive", + "Role": { + "Fn::GetAtt": [ + "driveStreamRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "driveStreamRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "driveQueue": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "driveQueue" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "Role": { + "Fn::GetAtt": [ + "driveQueueRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "driveQueueRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "driveTable": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "driveTable" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "Role": { + "Fn::GetAtt": [ + "driveTableRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "driveTableRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "streamProcessor": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "streamProcessor" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "Role": { + "Fn::GetAtt": [ + "streamProcessorRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "streamProcessorRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", + "arn:aws:iam::aws:policy/service-role/AWSLambdaKinesisExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "streamProcessorStream": { + "Type": "AWS::Lambda::EventSourceMapping", + "Properties": { + "EventSourceArn": { + "Fn::GetAtt": [ + "stream", + "Arn" + ] + }, + "FunctionName": { + "Ref": "streamProcessor" + }, + "MaximumRetryAttempts": 0, + "StartingPosition": "LATEST" + } + }, + "httpGetter": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "httpGetter" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "apigw-handler.handleGet", + "Role": { + "Fn::GetAtt": [ + "httpGetterRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 30, + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "httpGetterRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "httpGetterHttpApiEventPermission": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Ref": "httpGetter" + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Sub": [ + "arn:\${AWS::Partition}:execute-api:\${AWS::Region}:\${AWS::AccountId}:\${__ApiId__}/\${__Stage__}/GETitem", + { + "__ApiId__": { + "Ref": "ServerlessHttpApi" + }, + "__Stage__": "*" + } + ] + } + } + }, + "eventsRule": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "SamResourceId": "eventsRule", + "slicWatch": { + "alarms": { + "Lambda": { + "enabled": false + } + } + } + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "rule-handler.handleRule", + "Role": { + "Fn::GetAtt": [ + "eventsRuleRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "eventsRuleRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + } + }, + "eventsRuleTrigger": { + "Type": "AWS::Events::Rule", + "Properties": { + "EventPattern": { + "detail-type": [ + "Invoke Lambda Function" + ] + }, + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "eventsRule", + "Arn" + ] + }, + "Id": "eventsRuleTriggerLambdaTarget", + "RetryPolicy": { + "MaximumRetryAttempts": 0, + "MaximumEventAgeInSeconds": 60 + } + } + ] + } + }, + "eventsRuleTriggerPermission": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Ref": "eventsRule" + }, + "Principal": "events.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "eventsRuleTrigger", + "Arn" + ] + } + } + }, + "TestStateMachine": { + "Type": "AWS::StepFunctions::StateMachine", + "Metadata": { + "SamResourceId": "TestStateMachine" + }, + "Properties": { + "DefinitionS3Location": { + "Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "Key": "sam-test-project/754f906d12f592f99c5651c04a6a0a51" + }, + "RoleArn": { + "Fn::GetAtt": [ + "TestStateMachineRole", + "Arn" + ] + }, + "Tags": [ + { + "Key": "stateMachine:createdBy", + "Value": "SAM" + } + ], + "DefinitionSubstitutions": { + "HelloArn": { + "Fn::GetAtt": [ + "hello", + "Arn" + ] + }, + "AnotherHelloArn": { + "Fn::GetAtt": [ + "hello", + "Arn" + ] + } + } + } + }, + "TestStateMachineRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "states.amazonaws.com" + ] + } + } + ] + }, + "ManagedPolicyArns": [], + "Policies": [ + { + "PolicyName": "TestStateMachineRolePolicy0", + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "lambda:InvokeFunction" + ], + "Effect": "Allow", + "Resource": { + "Fn::Sub": [ + "arn:\${AWS::Partition}:lambda:\${AWS::Region}:\${AWS::AccountId}:function:\${functionName}*", + { + "functionName": { + "Ref": "hello" + } + } + ] + } + } + ] + } + }, + { + "PolicyName": "TestStateMachineRolePolicy1", + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "lambda:InvokeFunction" + ], + "Effect": "Allow", + "Resource": { + "Fn::Sub": [ + "arn:\${AWS::Partition}:lambda:\${AWS::Region}:\${AWS::AccountId}:function:\${functionName}*", + { + "functionName": { + "Ref": "hello" + } + } + ] + } + } + ] + } + } + ], + "Tags": [ + { + "Key": "stateMachine:createdBy", + "Value": "SAM" + } + ] + } + }, + "ServerlessHttpApi": { + "Type": "AWS::ApiGatewayV2::Api", + "Properties": { + "Body": { + "info": { + "version": "1.0", + "title": { + "Ref": "AWS::StackName" + } + }, + "paths": { + "item": { + "get": { + "x-amazon-apigateway-integration": { + "httpMethod": "POST", + "type": "aws_proxy", + "uri": { + "Fn::Sub": "arn:\${AWS::Partition}:apigateway:\${AWS::Region}:lambda:path/2015-03-31/functions/\${httpGetter.Arn}/invocations" + }, + "payloadFormatVersion": "2.0" + }, + "responses": {} + } + } + }, + "openapi": "3.0.1", + "tags": [ + { + "name": "httpapi:createdBy", + "x-amazon-apigateway-tag-value": "SAM" + } + ] + } + } + }, + "ServerlessHttpApiApiGatewayDefaultStage": { + "Type": "AWS::ApiGatewayV2::Stage", + "Properties": { + "ApiId": { + "Ref": "ServerlessHttpApi" + }, + "StageName": "$default", + "Tags": { + "httpapi:createdBy": "SAM" + }, + "AutoDeploy": true + } + }, + "slicWatchLambdaErrorsAlarmhello": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${hello}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${hello} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "hello" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmhello": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${hello}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${hello} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "hello" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "hello" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmhello": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${hello}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${hello} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "hello" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmhello": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${hello}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${hello} breaches 2", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "hello" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2 + } + }, + "slicWatchLambdaIteratorAgeAlarmstreamProcessor": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_IteratorAge_\${streamProcessor}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "IteratorAge for \${streamProcessor} breaches 10000", + {} + ] + }, + "MetricName": "IteratorAge", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "streamProcessor" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10000 + } + }, + "slicWatchLambdaErrorsAlarmping": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${ping}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${ping} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ping" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmping": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${ping}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${ping} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ping" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ping" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmping": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${ping}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${ping} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ping" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmping": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${ping}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${ping} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ping" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmthrottler": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${throttler}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${throttler} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "throttler" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmthrottler": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${throttler}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${throttler} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "throttler" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "throttler" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmthrottler": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${throttler}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${throttler} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "throttler" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmthrottler": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${throttler}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${throttler} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "throttler" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmdriveStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${driveStream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${driveStream} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveStream" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmdriveStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${driveStream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${driveStream} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveStream" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveStream" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmdriveStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${driveStream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${driveStream} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveStream" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmdriveStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${driveStream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${driveStream} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveStream" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmdriveQueue": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${driveQueue}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${driveQueue} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveQueue" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmdriveQueue": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${driveQueue}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${driveQueue} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveQueue" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveQueue" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmdriveQueue": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${driveQueue}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${driveQueue} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveQueue" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmdriveQueue": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${driveQueue}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${driveQueue} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveQueue" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmdriveTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${driveTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${driveTable} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveTable" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmdriveTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${driveTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${driveTable} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveTable" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveTable" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmdriveTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${driveTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${driveTable} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveTable" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmdriveTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${driveTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${driveTable} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveTable" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmstreamProcessor": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${streamProcessor}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${streamProcessor} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "streamProcessor" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmstreamProcessor": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${streamProcessor}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${streamProcessor} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "streamProcessor" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "streamProcessor" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmstreamProcessor": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${streamProcessor}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${streamProcessor} breaches 95% of timeout (3)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "streamProcessor" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 2850 + } + }, + "slicWatchLambdaInvocationsAlarmstreamProcessor": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${streamProcessor}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${streamProcessor} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "streamProcessor" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchLambdaErrorsAlarmhttpGetter": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${httpGetter}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${httpGetter} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "httpGetter" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmhttpGetter": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${httpGetter}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${httpGetter} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "httpGetter" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "httpGetter" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmhttpGetter": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${httpGetter}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${httpGetter} breaches 95% of timeout (30)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "httpGetter" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 28500 + } + }, + "slicWatchLambdaInvocationsAlarmhttpGetter": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${httpGetter}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${httpGetter} breaches 10", + {} + ] + }, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "httpGetter" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 10 + } + }, + "slicWatchStatesExecutionThrottledAlarmTestStateMachine": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "TestStateMachine" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionThrottledAlarm_\${TestStateMachine.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionThrottled Sum for \${TestStateMachine.Name} breaches 0", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchStatesExecutionsFailedAlarmTestStateMachine": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "TestStateMachine" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionsFailedAlarm_\${TestStateMachine.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionsFailed Sum for \${TestStateMachine.Name} breaches 0", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchStatesExecutionsTimedOutAlarmTestStateMachine": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "MetricName": "ExecutionsTimedOut", + "Namespace": "AWS/States", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "TestStateMachine" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionsTimedOutAlarm_\${TestStateMachine.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionsTimedOut Sum for \${TestStateMachine.Name} breaches 0", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchTableReadThrottleEventsAlarmdataTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "DDB_ReadThrottleEvents_Alarm_\${dataTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable} breaches 10", + {} + ] + }, + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchTableWriteThrottleEventsAlarmdataTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "DDB_WriteThrottleEvents_Alarm_\${dataTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable} breaches 10", + {} + ] + }, + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchTableUserErrorsAlarmdataTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "DDB_UserErrors_Alarm_\${dataTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable} breaches 0", + {} + ] + }, + "MetricName": "UserErrors", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchTableSystemErrorsAlarmdataTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "DDB_SystemErrors_Alarm_\${dataTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable} breaches 0", + {} + ] + }, + "MetricName": "SystemErrors", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchGSIReadThrottleEventsAlarmdataTableGSI1": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "DDB_ReadThrottleEvents_Alarm_\${dataTable}GSI1", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable}GSI1 breaches 10", + {} + ] + }, + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + }, + { + "Name": "GlobalSecondaryIndex", + "Value": "GSI1" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchGSIWriteThrottleEventsAlarmdataTableGSI1": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "DDB_WriteThrottleEvents_Alarm_\${dataTable}GSI1", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable}GSI1 breaches 10", + {} + ] + }, + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + }, + { + "Name": "GlobalSecondaryIndex", + "Value": "GSI1" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchKinesisStreamIteratorAgeAlarmStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamIteratorAge_\${stream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Maximum GetRecords.IteratorAgeMilliseconds for \${stream} breaches 10000 milliseconds", + {} + ] + }, + "MetricName": "GetRecords.IteratorAgeMilliseconds", + "Namespace": "AWS/Kinesis", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Maximum", + "Threshold": 10000 + } + }, + "slicWatchKinesisStreamReadThroughputAlarmStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamReadThroughput_\${stream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Sum ReadProvisionedThroughputExceeded for \${stream} breaches 0 milliseconds", + {} + ] + }, + "MetricName": "ReadProvisionedThroughputExceeded", + "Namespace": "AWS/Kinesis", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchKinesisStreamWriteThroughputAlarmStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamWriteThroughput_\${stream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Sum WriteProvisionedThroughputExceeded for \${stream} breaches 0 milliseconds", + {} + ] + }, + "MetricName": "WriteProvisionedThroughputExceeded", + "Namespace": "AWS/Kinesis", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchKinesisStreamPutRecordSuccessAlarmStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamPutRecordSuccess_\${stream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Average PutRecord.Success for \${stream} breaches 1 milliseconds", + {} + ] + }, + "MetricName": "PutRecord.Success", + "Namespace": "AWS/Kinesis", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "LessThanThreshold", + "Statistic": "Average", + "Threshold": 1 + } + }, + "slicWatchKinesisStreamPutRecordsSuccessAlarmStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamPutRecordsSuccess_\${stream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Average PutRecords.Success for \${stream} breaches 1 milliseconds", + {} + ] + }, + "MetricName": "PutRecords.Success", + "Namespace": "AWS/Kinesis", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "LessThanThreshold", + "Statistic": "Average", + "Threshold": 1 + } + }, + "slicWatchKinesisStreamGetRecordsSuccessAlarmStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamGetRecordsSuccess_\${stream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Average GetRecords.Success for \${stream} breaches 1 milliseconds", + {} + ] + }, + "MetricName": "GetRecords.Success", + "Namespace": "AWS/Kinesis", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "LessThanThreshold", + "Statistic": "Average", + "Threshold": 1 + } + }, + "slicWatchSQSInFlightMsgsAlarmregularQueue": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateNumberOfMessagesNotVisible_\${regularQueue.QueueName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SQS in-flight messages for \${regularQueue.QueueName} breaches 1200 (1% of the hard limit of 120000)", + {} + ] + }, + "MetricName": "ApproximateNumberOfMessagesNotVisible", + "Namespace": "AWS/SQS", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "regularQueue", + "QueueName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Maximum", + "Threshold": 1200 + } + }, + "slicWatchSQSOldestMsgAgeAlarmregularQueue": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateAgeOfOldestMessage_\${regularQueue.QueueName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SQS age of oldest message in the queue \${regularQueue.QueueName} breaches 60", + {} + ] + }, + "MetricName": "ApproximateAgeOfOldestMessage", + "Namespace": "AWS/SQS", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "regularQueue", + "QueueName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Maximum", + "Threshold": 60 + } + }, + "slicWatchSQSInFlightMsgsAlarmfifoQueue": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateNumberOfMessagesNotVisible_\${fifoQueue.QueueName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SQS in-flight messages for \${fifoQueue.QueueName} breaches 200 (1% of the hard limit of 20000)", + {} + ] + }, + "MetricName": "ApproximateNumberOfMessagesNotVisible", + "Namespace": "AWS/SQS", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "fifoQueue", + "QueueName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Maximum", + "Threshold": 200 + } + }, + "slicWatchSQSOldestMsgAgeAlarmfifoQueue": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateAgeOfOldestMessage_\${fifoQueue.QueueName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SQS age of oldest message in the queue \${fifoQueue.QueueName} breaches 60", + {} + ] + }, + "MetricName": "ApproximateAgeOfOldestMessage", + "Namespace": "AWS/SQS", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "fifoQueue", + "QueueName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Maximum", + "Threshold": 60 + } + }, + "slicWatchECSMemoryAlarmecsService": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "ECS_MemoryAlarm_\${ecsService.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "ECS MemoryUtilization for \${ecsService.Name} breaches 90", + {} + ] + }, + "MetricName": "MemoryUtilization", + "Namespace": "AWS/ECS", + "Dimensions": [ + { + "Name": "ServiceName", + "Value": { + "Fn::GetAtt": [ + "ecsService", + "Name" + ] + } + }, + { + "Name": "ClusterName", + "Value": { + "Ref": "ecsCluster" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 90 + } + }, + "slicWatchECSCPUAlarmecsService": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmName": { + "Fn::Sub": [ + "ECS_CPUAlarm_\${ecsService.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "ECS CPUUtilization for \${ecsService.Name} breaches 90", + {} + ] + }, + "MetricName": "CPUUtilization", + "Namespace": "AWS/ECS", + "Dimensions": [ + { + "Name": "ServiceName", + "Value": { + "Fn::GetAtt": [ + "ecsService", + "Name" + ] + } + }, + { + "Name": "ClusterName", + "Value": { + "Ref": "ecsCluster" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 90 + } + }, + "slicWatchSNSNumberOfNotificationsFilteredOutInvalidAttributesAlarmMonitoringTopic": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "MetricName": "NumberOfNotificationsFilteredOut-InvalidAttributes", + "Namespace": "AWS/SNS", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "MonitoringTopic", + "TopicName" + ] + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFilteredOutInvalidAttributes_Alarm_\${MonitoringTopic.TopicName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFilteredOutInvalidAttributes for \${MonitoringTopic.TopicName} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchSNSNumberOfNotificationsFailedAlarmMonitoringTopic": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "MetricName": "NumberOfNotificationsFailed", + "Namespace": "AWS/SNS", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "MonitoringTopic", + "TopicName" + ] + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFailed_Alarm_\${MonitoringTopic.TopicName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFailed for \${MonitoringTopic.TopicName} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchEventsFailedInvocationsAlarmEventsRuleTrigger": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "MetricName": "FailedInvocations", + "Namespace": "AWS/Events", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "eventsRuleTrigger" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "Events_FailedInvocations_Alarm_\${eventsRuleTrigger}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge FailedInvocations for \${eventsRuleTrigger} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchEventsThrottledRulesAlarmEventsRuleTrigger": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "MetricName": "ThrottledRules", + "Namespace": "AWS/Events", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "eventsRuleTrigger" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "Events_ThrottledRules_Alarm_\${eventsRuleTrigger}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge ThrottledRules for \${eventsRuleTrigger} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchDashboard": { + "Type": "AWS::CloudWatch::Dashboard", + "Properties": { + "DashboardBody": { + "Fn::Sub": { + "start": "-PT3H", + "widgets": [ + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/States", + "ExecutionsFailed", + "StateMachineArn", + "\${TestStateMachine}", + { + "stat": "Sum" + } + ], + [ + "AWS/States", + "ExecutionThrottled", + "StateMachineArn", + "\${TestStateMachine}", + { + "stat": "Sum" + } + ], + [ + "AWS/States", + "ExecutionsTimedOut", + "StateMachineArn", + "\${TestStateMachine}", + { + "stat": "Sum" + } + ] + ], + "title": "\${TestStateMachine.Name} Step Function Executions", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + { + "stat": "Sum" + } + ] + ], + "title": "ReadThrottleEvents Table \${dataTable}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + "GlobalSecondaryIndex", + "GSI1", + { + "stat": "Sum" + } + ] + ], + "title": "ReadThrottleEvents GSI GSI1 in \${dataTable}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + "GlobalSecondaryIndex", + "GSI1", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "WriteThrottleEvents", + "TableName", + "\${dataTable}", + { + "stat": "Sum" + } + ] + ], + "title": "WriteThrottleEvents Table \${dataTable}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + "GlobalSecondaryIndex", + "GSI1", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "WriteThrottleEvents", + "TableName", + "\${dataTable}", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "WriteThrottleEvents", + "TableName", + "\${dataTable}", + "GlobalSecondaryIndex", + "GSI1", + { + "stat": "Sum" + } + ] + ], + "title": "WriteThrottleEvents GSI GSI1 in \${dataTable}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${hello}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${throttler}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${driveStream}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${driveQueue}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${driveTable}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${streamProcessor}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${httpGetter}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${eventsRule}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Errors Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${hello}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${throttler}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${driveStream}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${driveQueue}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${driveTable}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${streamProcessor}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${httpGetter}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${eventsRule}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Throttles Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${hello}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${throttler}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${driveStream}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${driveQueue}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${driveTable}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${streamProcessor}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${httpGetter}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${eventsRule}", + { + "stat": "Average" + } + ] + ], + "title": "Lambda Duration Average per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${hello}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${throttler}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${driveStream}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${driveQueue}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${driveTable}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${streamProcessor}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${httpGetter}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${eventsRule}", + { + "stat": "p95" + } + ] + ], + "title": "Lambda Duration p95 per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${hello}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${throttler}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${driveStream}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${driveQueue}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${driveTable}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${streamProcessor}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${httpGetter}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${eventsRule}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda Duration Maximum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 18 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${hello}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${throttler}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${driveStream}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${driveQueue}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${driveTable}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${streamProcessor}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${httpGetter}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${eventsRule}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Invocations Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 18 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${hello}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${throttler}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${driveStream}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${driveQueue}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${driveTable}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${streamProcessor}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${httpGetter}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${eventsRule}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda ConcurrentExecutions Maximum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 18 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "IteratorAge", + "FunctionName", + "\${streamProcessor}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda IteratorAge \${streamProcessor} Maximum", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 24 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Kinesis", + "GetRecords.IteratorAgeMilliseconds", + "StreamName", + "\${stream}", + { + "stat": "Maximum" + } + ] + ], + "title": "IteratorAge \${stream} Kinesis", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 24 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Kinesis", + "PutRecord.Success", + "StreamName", + "\${stream}", + { + "stat": "Average" + } + ], + [ + "AWS/Kinesis", + "PutRecords.Success", + "StreamName", + "\${stream}", + { + "stat": "Average" + } + ], + [ + "AWS/Kinesis", + "GetRecords.Success", + "StreamName", + "\${stream}", + { + "stat": "Average" + } + ] + ], + "title": "Get/Put Success \${stream} Kinesis", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 24 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Kinesis", + "ReadProvisionedThroughputExceeded", + "StreamName", + "\${stream}", + { + "stat": "Sum" + } + ], + [ + "AWS/Kinesis", + "WriteProvisionedThroughputExceeded", + "StreamName", + "\${stream}", + { + "stat": "Sum" + } + ] + ], + "title": "Provisioned Throughput \${stream} Kinesis", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 30 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "NumberOfMessagesSent", + "QueueName", + "\${regularQueue.QueueName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SQS", + "NumberOfMessagesReceived", + "QueueName", + "\${regularQueue.QueueName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SQS", + "NumberOfMessagesDeleted", + "QueueName", + "\${regularQueue.QueueName}", + { + "stat": "Sum" + } + ] + ], + "title": "Messages \${regularQueue.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 30 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "ApproximateAgeOfOldestMessage", + "QueueName", + "\${regularQueue.QueueName}", + { + "stat": "Maximum" + } + ] + ], + "title": "Oldest Message age \${regularQueue.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 30 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "ApproximateNumberOfMessagesVisible", + "QueueName", + "\${regularQueue.QueueName}", + { + "stat": "Maximum" + } + ] + ], + "title": "Messages in queue \${regularQueue.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 36 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "NumberOfMessagesSent", + "QueueName", + "\${fifoQueue.QueueName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SQS", + "NumberOfMessagesReceived", + "QueueName", + "\${fifoQueue.QueueName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SQS", + "NumberOfMessagesDeleted", + "QueueName", + "\${fifoQueue.QueueName}", + { + "stat": "Sum" + } + ] + ], + "title": "Messages \${fifoQueue.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 36 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "ApproximateAgeOfOldestMessage", + "QueueName", + "\${fifoQueue.QueueName}", + { + "stat": "Maximum" + } + ] + ], + "title": "Oldest Message age \${fifoQueue.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 36 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "ApproximateNumberOfMessagesVisible", + "QueueName", + "\${fifoQueue.QueueName}", + { + "stat": "Maximum" + } + ] + ], + "title": "Messages in queue \${fifoQueue.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 42 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ECS", + "MemoryUtilization", + "ServiceName", + "\${ecsService.Name}", + "ClusterName", + "\${ecsCluster}", + { + "stat": "Average" + } + ], + [ + "AWS/ECS", + "CPUUtilization", + "ServiceName", + "\${ecsService.Name}", + "ClusterName", + "\${ecsCluster}", + { + "stat": "Average" + } + ] + ], + "title": "ECS Service \${ecsService.Name}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 42 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SNS", + "NumberOfNotificationsFilteredOut-InvalidAttributes", + "TopicName", + "\${MonitoringTopic.TopicName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SNS", + "NumberOfNotificationsFailed", + "TopicName", + "\${MonitoringTopic.TopicName}", + { + "stat": "Sum" + } + ] + ], + "title": "SNS Topic \${MonitoringTopic.TopicName}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 42 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Events", + "FailedInvocations", + "RuleName", + "\${eventsRuleTrigger}", + { + "stat": "Sum" + } + ], + [ + "AWS/Events", + "ThrottledRules", + "RuleName", + "\${eventsRuleTrigger}", + { + "stat": "Sum" + } + ], + [ + "AWS/Events", + "Invocations", + "RuleName", + "\${eventsRuleTrigger}", + { + "stat": "Sum" + } + ] + ], + "title": "EventBridge Rule \${eventsRuleTrigger}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 48 + } + ] + } + } + } + } + } +} +` diff --git a/tap-snapshots/serverless-test-project-alb/tests/snapshot/serverless-test-project-alb-snapshot.test.ts.test.cjs b/tap-snapshots/serverless-test-project-alb/tests/snapshot/serverless-test-project-alb-snapshot.test.ts.test.cjs new file mode 100644 index 00000000..9474e838 --- /dev/null +++ b/tap-snapshots/serverless-test-project-alb/tests/snapshot/serverless-test-project-alb-snapshot.test.ts.test.cjs @@ -0,0 +1,1064 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb-snapshot.test.ts > TAP > serverless-test-project-alb snapshot > serverless-test-project-alb template 1`] = ` +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "The AWS CloudFormation template for this Serverless application", + "Resources": { + "ServerlessDeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + } + }, + "ServerlessDeploymentBucketPolicy": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Effect": "Deny", + "Principal": "*", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "ServerlessDeploymentBucket" + }, + "/*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "ServerlessDeploymentBucket" + } + ] + ] + } + ], + "Condition": { + "Bool": { + "aws:SecureTransport": false + } + } + } + ] + } + } + }, + "AlbEventLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-alb-dev-albEvent" + } + }, + "IamRoleLambdaExecution": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + }, + "Policies": [ + { + "PolicyName": { + "Fn::Join": [ + "-", + [ + "serverless-test-project-alb", + "dev", + "lambda" + ] + ] + }, + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogStream", + "logs:CreateLogGroup", + "logs:TagResource" + ], + "Resource": [ + { + "Fn::Sub": "arn:\${AWS::Partition}:logs:\${AWS::Region}:\${AWS::AccountId}:log-group:/aws/lambda/serverless-test-project-alb-dev*:*" + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "logs:PutLogEvents" + ], + "Resource": [ + { + "Fn::Sub": "arn:\${AWS::Partition}:logs:\${AWS::Region}:\${AWS::AccountId}:log-group:/aws/lambda/serverless-test-project-alb-dev*:*:*" + } + ] + } + ] + } + } + ], + "Path": "/", + "RoleName": { + "Fn::Join": [ + "-", + [ + "serverless-test-project-alb", + "dev", + { + "Ref": "AWS::Region" + }, + "lambdaRole" + ] + ] + } + } + }, + "AlbEventLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project-alb/dev/1701242684385-2023-11-29T07:24:44.385Z/serverless-test-project-alb.zip" + }, + "Handler": "alb-handler.handleALB", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-alb-dev-albEvent", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "AlbEventLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "AlbEventLambdaVersion0XznAenLykwY99KhRhuWhGA2GO8nTdlRqGtjPoaDgg": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "AlbEventLambdaFunction" + }, + "CodeSha256": "iF0ZcJ5dWZd/RnBzvEqO7WAQlHbLsco8p4dUx4U7AL8=" + } + }, + "AlbEventAlbTargetGrouphttpListener": { + "Type": "AWS::ElasticLoadBalancingV2::TargetGroup", + "Properties": { + "TargetType": "lambda", + "Targets": [ + { + "Id": { + "Fn::GetAtt": [ + "AlbEventLambdaFunction", + "Arn" + ] + } + } + ], + "Name": "1d5fdfd5099ec257209ef7b7c5ee8cb4", + "Tags": [ + { + "Key": "Name", + "Value": "serverless-test-project-alb-albEvent-httpListener-dev" + } + ], + "TargetGroupAttributes": [ + { + "Key": "lambda.multi_value_headers.enabled", + "Value": false + } + ], + "HealthCheckEnabled": true, + "HealthCheckPath": "/", + "HealthCheckIntervalSeconds": 35, + "HealthCheckTimeoutSeconds": 30, + "HealthyThresholdCount": 5, + "UnhealthyThresholdCount": 5, + "Matcher": { + "HttpCode": "200" + } + }, + "DependsOn": [ + "AlbEventLambdaPermissionRegisterTarget" + ] + }, + "AlbEventAlbListenerRule1": { + "Type": "AWS::ElasticLoadBalancingV2::ListenerRule", + "Properties": { + "Actions": [ + { + "Type": "forward", + "TargetGroupArn": { + "Ref": "AlbEventAlbTargetGrouphttpListener" + } + } + ], + "Conditions": [ + { + "Field": "path-pattern", + "Values": [ + "/handleALB" + ] + }, + { + "Field": "http-request-method", + "HttpRequestMethodConfig": { + "Values": [ + "POST" + ] + } + } + ], + "ListenerArn": { + "Ref": "httpListener" + }, + "Priority": 1 + } + }, + "AlbEventLambdaPermissionAlb": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "FunctionName": { + "Fn::GetAtt": [ + "AlbEventLambdaFunction", + "Arn" + ] + }, + "Action": "lambda:InvokeFunction", + "Principal": "elasticloadbalancing.amazonaws.com", + "SourceArn": { + "Ref": "AlbEventAlbTargetGrouphttpListener" + } + } + }, + "AlbEventLambdaPermissionRegisterTarget": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "FunctionName": { + "Fn::GetAtt": [ + "AlbEventLambdaFunction", + "Arn" + ] + }, + "Action": "lambda:InvokeFunction", + "Principal": "elasticloadbalancing.amazonaws.com" + } + }, + "bucket": { + "Type": "AWS::S3::Bucket" + }, + "vpcALB": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/20", + "EnableDnsSupport": true, + "EnableDnsHostnames": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + } + }, + "internetGateway": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + } + }, + "vpcGatewayAttachment": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "VpcId": { + "Ref": "vpcALB" + }, + "InternetGatewayId": { + "Ref": "internetGateway" + } + } + }, + "subnetA": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": "eu-west-1a", + "CidrBlock": "10.0.5.0/24", + "VpcId": { + "Ref": "vpcALB" + }, + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + } + }, + "subnetB": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": "eu-west-1b", + "CidrBlock": "10.0.6.0/24", + "VpcId": { + "Ref": "vpcALB" + }, + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + } + }, + "routeTableA": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "vpcALB" + }, + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + } + }, + "routeTableB": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "vpcALB" + }, + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + } + }, + "routeTableAssociationSubnetA": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "SubnetId": { + "Ref": "subnetA" + }, + "RouteTableId": { + "Ref": "routeTableA" + } + } + }, + "routeTableAssociationSubnetB": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "SubnetId": { + "Ref": "subnetB" + }, + "RouteTableId": { + "Ref": "routeTableB" + } + } + }, + "routeTableAInternetRoute": { + "Type": "AWS::EC2::Route", + "DependsOn": [ + "vpcGatewayAttachment" + ], + "Properties": { + "RouteTableId": { + "Ref": "routeTableA" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "internetGateway" + } + } + }, + "routeTableBInternetRoute": { + "Type": "AWS::EC2::Route", + "DependsOn": [ + "vpcGatewayAttachment" + ], + "Properties": { + "RouteTableId": { + "Ref": "routeTableB" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "internetGateway" + } + } + }, + "alb": { + "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", + "Properties": { + "Name": "awesome-loadBalancer", + "Type": "application", + "Subnets": [ + { + "Ref": "subnetA" + }, + { + "Ref": "subnetB" + } + ], + "SecurityGroups": [ + { + "Ref": "albSecurityGroup" + } + ] + } + }, + "httpListener": { + "Type": "AWS::ElasticLoadBalancingV2::Listener", + "Properties": { + "LoadBalancerArn": { + "Ref": "alb" + }, + "Port": 80, + "Protocol": "HTTP", + "DefaultActions": [ + { + "Type": "redirect", + "RedirectConfig": { + "Protocol": "HTTP", + "Port": 400, + "Host": "#{host}", + "Path": "/#{path}", + "Query": "#{query}", + "StatusCode": "HTTP_301" + } + } + ] + } + }, + "albSecurityGroup": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Allow http to client host", + "VpcId": { + "Ref": "vpcALB" + }, + "SecurityGroupIngress": [ + { + "IpProtocol": "tcp", + "FromPort": 80, + "ToPort": 80, + "CidrIp": "0.0.0.0/0" + }, + { + "IpProtocol": "tcp", + "FromPort": 443, + "ToPort": 443, + "CidrIp": "0.0.0.0/0" + } + ] + } + }, + "slicWatchDashboard": { + "Type": "AWS::CloudWatch::Dashboard", + "Properties": { + "DashboardBody": { + "Fn::Sub": { + "start": "-PT3H", + "widgets": [ + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${AlbEventLambdaFunction}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Errors Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${AlbEventLambdaFunction}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Throttles Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${AlbEventLambdaFunction}", + { + "stat": "Average" + } + ] + ], + "title": "Lambda Duration Average per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${AlbEventLambdaFunction}", + { + "stat": "p95" + } + ] + ], + "title": "Lambda Duration p95 per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${AlbEventLambdaFunction}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda Duration Maximum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${AlbEventLambdaFunction}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Invocations Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${AlbEventLambdaFunction}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda ConcurrentExecutions Maximum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApplicationELB", + "HTTPCode_ELB_5XX_Count", + "LoadBalancer", + "\${alb.LoadBalancerFullName}", + { + "stat": "Sum" + } + ], + [ + "AWS/ApplicationELB", + "RejectedConnectionCount", + "LoadBalancer", + "\${alb.LoadBalancerFullName}", + { + "stat": "Sum" + } + ] + ], + "title": "ALB \${alb.LoadBalancerName}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApplicationELB", + "HTTPCode_Target_5XX_Count", + "LoadBalancer", + "\${alb.LoadBalancerFullName}", + "TargetGroup", + "\${AlbEventAlbTargetGrouphttpListener.TargetGroupFullName}", + { + "stat": "Sum" + } + ], + [ + "AWS/ApplicationELB", + "UnHealthyHostCount", + "LoadBalancer", + "\${alb.LoadBalancerFullName}", + "TargetGroup", + "\${AlbEventAlbTargetGrouphttpListener.TargetGroupFullName}", + { + "stat": "Average" + } + ], + [ + "AWS/ApplicationELB", + "LambdaInternalError", + "LoadBalancer", + "\${alb.LoadBalancerFullName}", + "TargetGroup", + "\${AlbEventAlbTargetGrouphttpListener.TargetGroupFullName}", + { + "stat": "Sum" + } + ], + [ + "AWS/ApplicationELB", + "LambdaUserError", + "LoadBalancer", + "\${alb.LoadBalancerFullName}", + "TargetGroup", + "\${AlbEventAlbTargetGrouphttpListener.TargetGroupFullName}", + { + "stat": "Sum" + } + ] + ], + "title": "Target Group \${alb.LoadBalancerName}/\${AlbEventAlbTargetGrouphttpListener.TargetGroupName}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 12 + } + ] + } + } + } + }, + "slicWatchLoadBalancerHTTPCodeELB5XXCountAlarmAlb": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "MetricName": "HTTPCode_ELB_5XX_Count", + "Namespace": "AWS/ApplicationELB", + "Dimensions": [ + { + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "alb", + "LoadBalancerFullName" + ] + } + } + ], + "AlarmName": "LoadBalancer_HTTPCodeELB5XXCountAlarm_alb", + "AlarmDescription": "LoadBalancer HTTPCodeELB5XXCount Sum for alb breaches 0", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchLoadBalancerRejectedConnectionCountAlarmAlb": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "MetricName": "RejectedConnectionCount", + "Namespace": "AWS/ApplicationELB", + "Dimensions": [ + { + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "alb", + "LoadBalancerFullName" + ] + } + } + ], + "AlarmName": "LoadBalancer_RejectedConnectionCountAlarm_alb", + "AlarmDescription": "LoadBalancer RejectedConnectionCount Sum for alb breaches 0", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchLoadBalancerHTTPCodeTarget5XXCountAlarmAlbEventAlbTargetGrouphttpListener": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": "LoadBalancer_HTTPCodeTarget5XXCountAlarm_AlbEventAlbTargetGrouphttpListener", + "AlarmDescription": "LoadBalancer HTTPCode_Target_5XX_Count Sum for AlbEventAlbTargetGrouphttpListener breaches 0", + "MetricName": "HTTPCode_Target_5XX_Count", + "Statistic": "Sum", + "Namespace": "AWS/ApplicationELB", + "Dimensions": [ + { + "Name": "TargetGroup", + "Value": { + "Fn::GetAtt": [ + "AlbEventAlbTargetGrouphttpListener", + "TargetGroupFullName" + ] + } + }, + { + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "alb", + "LoadBalancerFullName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLoadBalancerUnHealthyHostCountAlarmAlbEventAlbTargetGrouphttpListener": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": "LoadBalancer_UnHealthyHostCountAlarm_AlbEventAlbTargetGrouphttpListener", + "AlarmDescription": "LoadBalancer UnHealthyHostCount Average for AlbEventAlbTargetGrouphttpListener breaches 0", + "MetricName": "UnHealthyHostCount", + "Statistic": "Average", + "Namespace": "AWS/ApplicationELB", + "Dimensions": [ + { + "Name": "TargetGroup", + "Value": { + "Fn::GetAtt": [ + "AlbEventAlbTargetGrouphttpListener", + "TargetGroupFullName" + ] + } + }, + { + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "alb", + "LoadBalancerFullName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLoadBalancerLambdaInternalErrorAlarmAlbEventAlbTargetGrouphttpListener": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": "LoadBalancer_LambdaInternalErrorAlarm_AlbEventAlbTargetGrouphttpListener", + "AlarmDescription": "LoadBalancer LambdaInternalError Sum for AlbEventAlbTargetGrouphttpListener breaches 0", + "MetricName": "LambdaInternalError", + "Statistic": "Sum", + "Namespace": "AWS/ApplicationELB", + "Dimensions": [ + { + "Name": "TargetGroup", + "Value": { + "Fn::GetAtt": [ + "AlbEventAlbTargetGrouphttpListener", + "TargetGroupFullName" + ] + } + }, + { + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "alb", + "LoadBalancerFullName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLoadBalancerLambdaUserErrorAlarmAlbEventAlbTargetGrouphttpListener": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": "LoadBalancer_LambdaUserErrorAlarm_AlbEventAlbTargetGrouphttpListener", + "AlarmDescription": "LoadBalancer LambdaUserError Sum for AlbEventAlbTargetGrouphttpListener breaches 0", + "MetricName": "LambdaUserError", + "Statistic": "Sum", + "Namespace": "AWS/ApplicationELB", + "Dimensions": [ + { + "Name": "TargetGroup", + "Value": { + "Fn::GetAtt": [ + "AlbEventAlbTargetGrouphttpListener", + "TargetGroupFullName" + ] + } + }, + { + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "alb", + "LoadBalancerFullName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + } + }, + "Outputs": { + "ServerlessDeploymentBucketName": { + "Value": { + "Ref": "ServerlessDeploymentBucket" + }, + "Export": { + "Name": "sls-serverless-test-project-alb-dev-ServerlessDeploymentBucketName" + } + }, + "AlbEventLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "AlbEventLambdaVersion0XznAenLykwY99KhRhuWhGA2GO8nTdlRqGtjPoaDgg" + }, + "Export": { + "Name": "sls-serverless-test-project-alb-dev-AlbEventLambdaFunctionQualifiedArn" + } + } + } +} +` diff --git a/tap-snapshots/serverless-test-project-appsync/tests/snapshot/serverless-test-project-appsync-snapshot.test.ts.test.cjs b/tap-snapshots/serverless-test-project-appsync/tests/snapshot/serverless-test-project-appsync-snapshot.test.ts.test.cjs new file mode 100644 index 00000000..b27ffbea --- /dev/null +++ b/tap-snapshots/serverless-test-project-appsync/tests/snapshot/serverless-test-project-appsync-snapshot.test.ts.test.cjs @@ -0,0 +1,928 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project-appsync-snapshot.test.ts > TAP > serverless-test-project-appsync snapshot > serverless-test-project-appsync template 1`] = ` +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "The AWS CloudFormation template for this Serverless application", + "Resources": { + "ServerlessDeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + } + }, + "ServerlessDeploymentBucketPolicy": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Effect": "Deny", + "Principal": "*", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "ServerlessDeploymentBucket" + }, + "/*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "ServerlessDeploymentBucket" + } + ] + ] + } + ], + "Condition": { + "Bool": { + "aws:SecureTransport": false + } + } + } + ] + } + } + }, + "bucket": { + "Type": "AWS::S3::Bucket" + }, + "BooksTable": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "bookId", + "KeyType": "HASH" + } + ], + "AttributeDefinitions": [ + { + "AttributeName": "bookId", + "AttributeType": "S" + } + ], + "Tags": [ + { + "Key": "Name", + "Value": "books-table" + } + ] + } + }, + "CognitoUserPool": { + "Type": "AWS::Cognito::UserPool", + "Properties": { + "AutoVerifiedAttributes": [ + "email" + ], + "Policies": { + "PasswordPolicy": { + "MinimumLength": 8, + "RequireLowercase": false, + "RequireNumbers": false, + "RequireUppercase": false, + "RequireSymbols": false + } + }, + "UsernameAttributes": [ + "email" + ], + "Schema": [ + { + "AttributeDataType": "String", + "Name": "name", + "Required": false, + "Mutable": true + } + ], + "UserPoolName": "BookStoreUserPool" + } + }, + "CognitoUserPoolClient": { + "Type": "AWS::Cognito::UserPoolClient", + "Properties": { + "UserPoolId": { + "Ref": "CognitoUserPool" + }, + "ClientName": "web", + "ExplicitAuthFlows": [ + "ALLOW_USER_SRP_AUTH", + "ALLOW_USER_PASSWORD_AUTH", + "ALLOW_REFRESH_TOKEN_AUTH" + ], + "PreventUserExistenceErrors": "ENABLED" + } + }, + "CognitoAdminGroup": { + "Type": "AWS::Cognito::UserPoolGroup", + "Properties": { + "UserPoolId": { + "Ref": "CognitoUserPool" + }, + "GroupName": "Admin", + "RoleArn": { + "Fn::GetAtt": [ + "CognitoAdminIAMrole", + "Arn" + ] + }, + "Description": "Admin users belong to this group" + } + }, + "CognitoAdminIAMrole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Federated": [ + "cognito-identity.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRoleWithWebIdentity" + ] + } + ] + }, + "Description": "This is the IAM role that admin group users name", + "Policies": [ + { + "PolicyName": "bookstore-admin-group-policy", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "dynamodb:*" + ], + "Resource": [ + { + "Fn::GetAtt": [ + "BooksTable", + "Arn" + ] + } + ] + } + ] + } + } + ], + "RoleName": "bookstore-admin-role" + } + }, + "CognitoCustomerGroup": { + "Type": "AWS::Cognito::UserPoolGroup", + "Properties": { + "UserPoolId": { + "Ref": "CognitoUserPool" + }, + "GroupName": "Customer", + "RoleArn": { + "Fn::GetAtt": [ + "CognitoUserIAMrole", + "Arn" + ] + }, + "Description": "Customer belongs to this group" + } + }, + "CognitoUserIAMrole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Federated": [ + "cognito-identity.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRoleWithWebIdentity" + ] + } + ] + }, + "Description": "This is the IAM role that admin group users name", + "Policies": [ + { + "PolicyName": "book-store-customer-group-policy", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "dynamodb:GetItem", + "dynamodb:Query", + "dynamodb:BatchGetItem" + ], + "Resource": [ + { + "Fn::GetAtt": [ + "BooksTable", + "Arn" + ] + } + ] + } + ] + } + } + ], + "RoleName": "bookstore-customer-role" + } + }, + "AwesomeappsyncGraphQlApi": { + "Type": "AWS::AppSync::GraphQLApi", + "Properties": { + "Name": "awesome-appsync", + "AuthenticationType": "AMAZON_COGNITO_USER_POOLS", + "AdditionalAuthenticationProviders": [], + "UserPoolConfig": { + "AwsRegion": "eu-west-1", + "UserPoolId": { + "Ref": "CognitoUserPool" + }, + "DefaultAction": "ALLOW" + }, + "XrayEnabled": false + } + }, + "AwesomeappsyncGraphQlSchema": { + "Type": "AWS::AppSync::GraphQLSchema", + "Properties": { + "Definition": "schema {\\n query: Query\\n mutation: Mutation\\n subscription: Subscription\\n}\\n\\ntype Subscription {\\n onCreateBook: Book @aws_subscribe(mutations: [\\"createBook\\"])\\n}\\n\\ntype Query {\\n getBookById(bookId: ID!): Book!\\n}\\n\\ntype Book {\\n bookId: ID!\\n title: String!\\n description: String\\n imageUrl: AWSURL\\n author: String!\\n price: Float!\\n createdAt: AWSDateTime!\\n updatedAt: AWSDateTime!\\n}\\n\\ntype Mutation {\\n createBook(newBook: BookInput): Book! @aws_auth(cognito_groups: [\\"Admin\\"])\\n}\\n\\ninput BookInput {\\n title: String!\\n description: String\\n imageUrl: AWSURL\\n author: String!\\n price: Float!\\n}", + "ApiId": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + } + } + }, + "AwesomeappsyncGraphQlDsbooksTableRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "appsync.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + }, + "Policies": [ + { + "PolicyName": "GraphQlDsbooksTablePolicy", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "dynamodb:DeleteItem", + "dynamodb:GetItem", + "dynamodb:PutItem", + "dynamodb:Query", + "dynamodb:Scan", + "dynamodb:UpdateItem", + "dynamodb:BatchGetItem", + "dynamodb:BatchWriteItem", + "dynamodb:ConditionCheckItem" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + ":", + [ + "arn", + "aws", + "dynamodb", + "eu-west-1", + { + "Ref": "AWS::AccountId" + }, + { + "Fn::Join": [ + "/", + [ + "table", + { + "Ref": "BooksTable" + } + ] + ] + } + ] + ] + }, + { + "Fn::Join": [ + "/", + [ + { + "Fn::Join": [ + ":", + [ + "arn", + "aws", + "dynamodb", + "eu-west-1", + { + "Ref": "AWS::AccountId" + }, + { + "Fn::Join": [ + "/", + [ + "table", + { + "Ref": "BooksTable" + } + ] + ] + } + ] + ] + }, + "*" + ] + ] + } + ] + } + ] + } + } + ] + } + }, + "AwesomeappsyncGraphQlDsbooksTable": { + "Type": "AWS::AppSync::DataSource", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + }, + "Name": "booksTable", + "Type": "AMAZON_DYNAMODB", + "ServiceRoleArn": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlDsbooksTableRole", + "Arn" + ] + }, + "DynamoDBConfig": { + "AwsRegion": "eu-west-1", + "TableName": { + "Ref": "BooksTable" + }, + "UseCallerCredentials": false, + "Versioned": false + } + } + }, + "AwesomeappsyncGraphQlResolverQuerygetBookById": { + "Type": "AWS::AppSync::Resolver", + "DependsOn": "AwesomeappsyncGraphQlSchema", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + }, + "TypeName": "Query", + "FieldName": "getBookById", + "RequestMappingTemplate": "#if ($context.info.selectionSetList.size() == 1 && $context.info.selectionSetList[0] == \\"id\\")\\n #set ($result = { \\"id\\": \\"$context.source.otherUserId\\" })\\n\\n #return($result)\\n#end\\n\\n{\\n \\"version\\" : \\"2018-05-29\\",\\n \\"operation\\" : \\"GetItem\\",\\n \\"key\\" : {\\n \\"bookId\\" : $util.dynamodb.toDynamoDBJson($context.arguments.bookId)\\n }\\n}", + "ResponseMappingTemplate": "$util.toJson($context.result)", + "Kind": "UNIT", + "DataSourceName": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlDsbooksTable", + "Name" + ] + } + } + }, + "AwesomeappsyncGraphQlResolverMutationcreateBook": { + "Type": "AWS::AppSync::Resolver", + "DependsOn": "AwesomeappsyncGraphQlSchema", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + }, + "TypeName": "Mutation", + "FieldName": "createBook", + "RequestMappingTemplate": "{\\n \\"version\\" : \\"2018-05-29\\",\\n \\"operation\\" : \\"PutItem\\",\\n \\"key\\": {\\n \\"bookId\\" : $util.dynamodb.toDynamoDBJson($util.autoId())\\n },\\n \\"attributeValues\\" : {\\n \\"title\\" : $util.dynamodb.toDynamoDBJson($context.arguments.newBook.title),\\n \\"description\\" : $util.dynamodb.toDynamoDBJson($context.arguments.newBook.description),\\n \\"imageUrl\\" : $util.dynamodb.toDynamoDBJson($context.arguments.newBook.imageUrl),\\n \\"author\\" : $util.dynamodb.toDynamoDBJson($context.arguments.newBook.author),\\n \\"price\\" : $util.dynamodb.toDynamoDBJson($context.arguments.newBook.price),\\n \\"createdAt\\": $util.dynamodb.toDynamoDBJson($util.time.nowISO8601()),\\n \\"updatedAt\\": $util.dynamodb.toDynamoDBJson($util.time.nowISO8601())\\n }\\n}", + "ResponseMappingTemplate": "$util.toJson($context.result)", + "Kind": "UNIT", + "DataSourceName": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlDsbooksTable", + "Name" + ] + } + } + }, + "slicWatchDashboard": { + "Type": "AWS::CloudWatch::Dashboard", + "Properties": { + "DashboardBody": { + "Fn::Sub": { + "start": "-PT3H", + "widgets": [ + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${BooksTable}", + { + "stat": "Sum" + } + ] + ], + "title": "ReadThrottleEvents Table \${BooksTable}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${BooksTable}", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "WriteThrottleEvents", + "TableName", + "\${BooksTable}", + { + "stat": "Sum" + } + ] + ], + "title": "WriteThrottleEvents Table \${BooksTable}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/AppSync", + "5XXError", + "GraphQLAPIId", + "\${AwesomeappsyncGraphQlApi.ApiId}", + { + "stat": "Sum", + "yAxis": "left" + } + ], + [ + "AWS/AppSync", + "4XXError", + "GraphQLAPIId", + "\${AwesomeappsyncGraphQlApi.ApiId}", + { + "stat": "Sum", + "yAxis": "left" + } + ], + [ + "AWS/AppSync", + "Latency", + "GraphQLAPIId", + "\${AwesomeappsyncGraphQlApi.ApiId}", + { + "stat": "Average", + "yAxis": "right" + } + ], + [ + "AWS/AppSync", + "Requests", + "GraphQLAPIId", + "\${AwesomeappsyncGraphQlApi.ApiId}", + { + "stat": "Maximum", + "yAxis": "left" + } + ] + ], + "title": "AppSync API awesome-appsync", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/AppSync", + "ConnectServerError", + "GraphQLAPIId", + "\${AwesomeappsyncGraphQlApi.ApiId}", + { + "stat": "Sum", + "yAxis": "left" + } + ], + [ + "AWS/AppSync", + "DisconnectServerError", + "GraphQLAPIId", + "\${AwesomeappsyncGraphQlApi.ApiId}", + { + "stat": "Sum", + "yAxis": "left" + } + ], + [ + "AWS/AppSync", + "SubscribeServerError", + "GraphQLAPIId", + "\${AwesomeappsyncGraphQlApi.ApiId}", + { + "stat": "Sum", + "yAxis": "left" + } + ], + [ + "AWS/AppSync", + "UnsubscribeServerError", + "GraphQLAPIId", + "\${AwesomeappsyncGraphQlApi.ApiId}", + { + "stat": "Sum", + "yAxis": "left" + } + ], + [ + "AWS/AppSync", + "PublishDataMessageServerError", + "GraphQLAPIId", + "\${AwesomeappsyncGraphQlApi.ApiId}", + { + "stat": "Sum", + "yAxis": "left" + } + ] + ], + "title": "AppSync Real-time Subscriptions awesome-appsync", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 6 + } + ] + } + } + } + }, + "slicWatchTableReadThrottleEventsAlarmBooksTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_ReadThrottleEvents_Alarm_\${BooksTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${BooksTable} breaches 10", + {} + ] + }, + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "BooksTable" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchTableWriteThrottleEventsAlarmBooksTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_WriteThrottleEvents_Alarm_\${BooksTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${BooksTable} breaches 10", + {} + ] + }, + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "BooksTable" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchTableUserErrorsAlarmBooksTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_UserErrors_Alarm_\${BooksTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${BooksTable} breaches 0", + {} + ] + }, + "MetricName": "UserErrors", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "BooksTable" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchTableSystemErrorsAlarmBooksTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_SystemErrors_Alarm_\${BooksTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${BooksTable} breaches 0", + {} + ] + }, + "MetricName": "SystemErrors", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "BooksTable" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchAppSync5XXErrorAlarmawesomeappsync": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": "AppSync_5XXErrorAlarm_awesome-appsync", + "AlarmDescription": "AppSync 5XXError Sum for awesome-appsync breaches 0", + "MetricName": "5XXError", + "Namespace": "AWS/AppSync", + "Dimensions": [ + { + "Name": "GraphQLAPIId", + "Value": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchAppSyncLatencyAlarmawesomeappsync": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": "AppSync_LatencyAlarm_awesome-appsync", + "AlarmDescription": "AppSync Latency Average for awesome-appsync breaches 0", + "MetricName": "Latency", + "Namespace": "AWS/AppSync", + "Dimensions": [ + { + "Name": "GraphQLAPIId", + "Value": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 0 + } + } + }, + "Outputs": { + "ServerlessDeploymentBucketName": { + "Value": { + "Ref": "ServerlessDeploymentBucket" + }, + "Export": { + "Name": "sls-serverless-test-project-appsync-dev-ServerlessDeploymentBucketName" + } + }, + "AwesomeappsyncGraphQlApiId": { + "Value": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + }, + "Export": { + "Name": { + "Fn::Sub": "\${AWS::StackName}-AwesomeappsyncGraphQlApiId" + } + } + }, + "AwesomeappsyncGraphQlApiUrl": { + "Value": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "GraphQLUrl" + ] + }, + "Export": { + "Name": { + "Fn::Sub": "\${AWS::StackName}-AwesomeappsyncGraphQlApiUrl" + } + } + } + } +} +` diff --git a/tap-snapshots/serverless-test-project/tests/snapshot/serverless-test-project-snapshot.test.ts.test.cjs b/tap-snapshots/serverless-test-project/tests/snapshot/serverless-test-project-snapshot.test.ts.test.cjs new file mode 100644 index 00000000..064d3adc --- /dev/null +++ b/tap-snapshots/serverless-test-project/tests/snapshot/serverless-test-project-snapshot.test.ts.test.cjs @@ -0,0 +1,4413 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`serverless-test-project/tests/snapshot/serverless-test-project-snapshot.test.ts > TAP > serverless-test-project snapshot > serverless-test-project template 1`] = ` +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "The AWS CloudFormation template for this Serverless application", + "Resources": { + "ServerlessDeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + } + }, + "ServerlessDeploymentBucketPolicy": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Effect": "Deny", + "Principal": "*", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "ServerlessDeploymentBucket" + }, + "/*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "ServerlessDeploymentBucket" + } + ] + ] + } + ], + "Condition": { + "Bool": { + "aws:SecureTransport": false + } + } + } + ] + } + } + }, + "HelloLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-hello" + } + }, + "PingLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-ping" + } + }, + "ThrottlerLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-throttler" + } + }, + "DriveStreamLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-driveStream" + } + }, + "DriveQueueLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-driveQueue" + } + }, + "DriveTableLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-driveTable" + } + }, + "StreamProcessorLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-streamProcessor" + } + }, + "HttpGetterLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-httpGetter" + } + }, + "SubscriptionHandlerLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-subscriptionHandler" + } + }, + "EventsRuleLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-eventsRule" + } + }, + "IamRoleLambdaExecution": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + }, + "Policies": [ + { + "PolicyName": { + "Fn::Join": [ + "-", + [ + "serverless-test-project", + "dev", + "lambda" + ] + ] + }, + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogStream", + "logs:CreateLogGroup", + "logs:TagResource" + ], + "Resource": [ + { + "Fn::Sub": "arn:\${AWS::Partition}:logs:\${AWS::Region}:\${AWS::AccountId}:log-group:/aws/lambda/serverless-test-project-dev*:*" + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "logs:PutLogEvents" + ], + "Resource": [ + { + "Fn::Sub": "arn:\${AWS::Partition}:logs:\${AWS::Region}:\${AWS::AccountId}:log-group:/aws/lambda/serverless-test-project-dev*:*:*" + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "kinesis:GetRecords", + "kinesis:GetShardIterator", + "kinesis:DescribeStream", + "kinesis:ListStreams" + ], + "Resource": [ + { + "Fn::GetAtt": [ + "stream", + "Arn" + ] + } + ] + } + ] + } + } + ], + "Path": "/", + "RoleName": { + "Fn::Join": [ + "-", + [ + "serverless-test-project", + "dev", + { + "Ref": "AWS::Region" + }, + "lambdaRole" + ] + ] + } + } + }, + "HelloLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "basic-handler.hello", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-hello", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "HelloLogGroup" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 2 + } + } + } + } + } + }, + "PingLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "basic-handler.hello", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-ping", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "PingLogGroup" + ], + "Metadata": { + "slicWatch": { + "dashboard": { + "enabled": false + } + } + } + }, + "ThrottlerLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "basic-handler.hello", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-throttler", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + }, + "ReservedConcurrentExecutions": 0 + }, + "DependsOn": [ + "ThrottlerLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "DriveStreamLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "stream-test-handler.handleDrive", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-driveStream", + "MemorySize": 1024, + "Timeout": 6, + "Environment": { + "Variables": { + "STREAM_NAME": { + "Ref": "stream" + } + } + }, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "DriveStreamLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "DriveQueueLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "queue-test-handler.handleDrive", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-driveQueue", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "DriveQueueLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "DriveTableLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "table-test-hander.handleDrive", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-driveTable", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "DriveTableLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "StreamProcessorLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "stream-handler.handle", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-streamProcessor", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "StreamProcessorLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "HttpGetterLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "apigw-handler.handleGet", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-httpGetter", + "MemorySize": 1024, + "Timeout": 30, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "HttpGetterLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "SubscriptionHandlerLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "apigw-handler.handleSubscription", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-subscriptionHandler", + "MemorySize": 1024, + "Timeout": 30, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "SubscriptionHandlerLogGroup" + ], + "Metadata": { + "slicWatch": {} + } + }, + "EventsRuleLambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "Handler": "rule-handler.handleRule", + "Runtime": "nodejs18.x", + "FunctionName": "serverless-test-project-dev-eventsRule", + "MemorySize": 1024, + "Timeout": 6, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + } + }, + "DependsOn": [ + "EventsRuleLogGroup" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "enabled": false + } + } + } + } + }, + "HelloLambdaVersioncvZrQjYr4FdYsM3CaTj5TKuOJmUjyL07tfIDVXBSw4": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "HelloLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "PingLambdaVersionSQcuddhSFqI0xKYCyuQTTJMvwrlKCB77CNQ16xyQ": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "PingLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "ThrottlerLambdaVersion0UeWLgxZYywcyV3gGiutpyCQJEbO6Gk8zSSOP7dMEps": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "ThrottlerLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "DriveStreamLambdaVersionsWkqlV7IV7mJdqIqQToVljMizTzZoDCso7qMazjI": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "DriveStreamLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "DriveQueueLambdaVersionTmzx8HCxfunJ3etrLOOYLg8zG05MzRauykeVpZFz8WY": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "DriveQueueLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "DriveTableLambdaVersionkqI0DCnUasgza04mnCpqj0q5vePTOojYtyi4hxfE3ME": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "DriveTableLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "StreamProcessorLambdaVersion24Kwch4oq5ogXKcIDJuLGB1qAJWt8aqgW43aCjKI": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "StreamProcessorLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "HttpGetterLambdaVersionvK2ALwc1DFqBccIyulxoBU3GveALO98nQc2xP94J8": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "HttpGetterLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "SubscriptionHandlerLambdaVersion4kKEYaIgWsMN0XYzRQn4VAailfQcZ23kdSSOKepfB4A": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "SubscriptionHandlerLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "EventsRuleLambdaVersionxBuN447jfeozyKD2CEV3oCIHhShTUOVe5XKOkBlbchQ": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "EventsRuleLambdaFunction" + }, + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" + } + }, + "WorkflowRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Sub": "states.\${AWS::Region}.amazonaws.com" + } + }, + "Action": "sts:AssumeRole" + } + ] + }, + "Policies": [ + { + "PolicyName": "dev-serverless-test-project-statemachine", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "lambda:InvokeFunction" + ], + "Resource": [ + { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + }, + { + "Fn::Sub": [ + "\${functionArn}:*", + { + "functionArn": { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + } + } + ] + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogDelivery", + "logs:GetLogDelivery", + "logs:UpdateLogDelivery", + "logs:DeleteLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:DescribeResourcePolicies", + "logs:DescribeLogGroups" + ], + "Resource": "*" + } + ] + } + } + ] + } + }, + "ExpressWorkflowRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Sub": "states.\${AWS::Region}.amazonaws.com" + } + }, + "Action": "sts:AssumeRole" + } + ] + }, + "Policies": [ + { + "PolicyName": "dev-serverless-test-project-statemachine", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "lambda:InvokeFunction" + ], + "Resource": [ + { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + }, + { + "Fn::Sub": [ + "\${functionArn}:*", + { + "functionArn": { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + } + } + ] + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogDelivery", + "logs:GetLogDelivery", + "logs:UpdateLogDelivery", + "logs:DeleteLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:DescribeResourcePolicies", + "logs:DescribeLogGroups" + ], + "Resource": "*" + } + ] + } + } + ] + } + }, + "Workflow": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Sub": [ + "{\\n \\"StartAt\\": \\"What Next?\\",\\n \\"States\\": {\\n \\"What Next?\\": {\\n \\"Type\\": \\"Choice\\",\\n \\"Choices\\": [\\n {\\n \\"Variable\\": \\"$.destination\\",\\n \\"StringEquals\\": \\"fail\\",\\n \\"Next\\": \\"Fail\\"\\n },\\n {\\n \\"Variable\\": \\"$.destination\\",\\n \\"StringEquals\\": \\"timeoutTask\\",\\n \\"Next\\": \\"TimeoutTask\\"\\n },\\n {\\n \\"Variable\\": \\"$.destination\\",\\n \\"StringEquals\\": \\"keepWaiting\\",\\n \\"Next\\": \\"KeepWaiting\\"\\n }\\n ],\\n \\"Default\\": \\"Succeed\\"\\n },\\n \\"TimeoutTask\\": {\\n \\"Type\\": \\"Task\\",\\n \\"TimeoutSeconds\\": 1,\\n \\"Resource\\": \\"\${085edd942ce144c5bd80364a6e973e4d}\\",\\n \\"Parameters\\": {\\n \\"sleepSeconds\\": 3\\n },\\n \\"Next\\": \\"Succeed\\"\\n },\\n \\"KeepWaiting\\": {\\n \\"Type\\": \\"Wait\\",\\n \\"Seconds\\": 1,\\n \\"Next\\": \\"KeepWaiting\\"\\n },\\n \\"Fail\\": {\\n \\"Type\\": \\"Fail\\"\\n },\\n \\"Succeed\\": {\\n \\"Type\\": \\"Pass\\",\\n \\"End\\": true\\n }\\n }\\n}", + { + "085edd942ce144c5bd80364a6e973e4d": { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + } + } + ] + }, + "RoleArn": { + "Fn::GetAtt": [ + "WorkflowRole", + "Arn" + ] + }, + "LoggingConfiguration": { + "Level": "ALL", + "IncludeExecutionData": true, + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "workflowLogGroup", + "Arn" + ] + } + } + } + ] + }, + "StateMachineName": "Workflow" + }, + "DependsOn": [ + "WorkflowRole" + ] + }, + "ExpressWorkflow": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Sub": [ + "{\\n \\"StartAt\\": \\"What Next?\\",\\n \\"States\\": {\\n \\"What Next?\\": {\\n \\"Type\\": \\"Choice\\",\\n \\"Choices\\": [\\n {\\n \\"Variable\\": \\"$.destination\\",\\n \\"StringEquals\\": \\"fail\\",\\n \\"Next\\": \\"Fail\\"\\n },\\n {\\n \\"Variable\\": \\"$.destination\\",\\n \\"StringEquals\\": \\"timeoutTask\\",\\n \\"Next\\": \\"TimeoutTask\\"\\n },\\n {\\n \\"Variable\\": \\"$.destination\\",\\n \\"StringEquals\\": \\"keepWaiting\\",\\n \\"Next\\": \\"KeepWaiting\\"\\n }\\n ],\\n \\"Default\\": \\"Succeed\\"\\n },\\n \\"TimeoutTask\\": {\\n \\"Type\\": \\"Task\\",\\n \\"TimeoutSeconds\\": 1,\\n \\"Resource\\": \\"\${085edd942ce144c5bd80364a6e973e4d}\\",\\n \\"Parameters\\": {\\n \\"sleepSeconds\\": 3\\n },\\n \\"Next\\": \\"Succeed\\"\\n },\\n \\"KeepWaiting\\": {\\n \\"Type\\": \\"Wait\\",\\n \\"Seconds\\": 1,\\n \\"Next\\": \\"KeepWaiting\\"\\n },\\n \\"Fail\\": {\\n \\"Type\\": \\"Fail\\"\\n },\\n \\"Succeed\\": {\\n \\"Type\\": \\"Pass\\",\\n \\"End\\": true\\n }\\n }\\n}", + { + "085edd942ce144c5bd80364a6e973e4d": { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + } + } + ] + }, + "RoleArn": { + "Fn::GetAtt": [ + "ExpressWorkflowRole", + "Arn" + ] + }, + "StateMachineType": "EXPRESS", + "LoggingConfiguration": { + "Level": "ALL", + "IncludeExecutionData": true, + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "expressWorkflowLogGroup", + "Arn" + ] + } + } + } + ] + }, + "StateMachineName": "ExpressWorkflow" + }, + "DependsOn": [ + "ExpressWorkflowRole" + ] + }, + "ApiGatewayRestApi": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "Name": "dev-serverless-test-project", + "EndpointConfiguration": { + "Types": [ + "REGIONAL" + ] + }, + "Policy": "" + } + }, + "ApiGatewayResourceItem": { + "Type": "AWS::ApiGateway::Resource", + "Properties": { + "ParentId": { + "Fn::GetAtt": [ + "ApiGatewayRestApi", + "RootResourceId" + ] + }, + "PathPart": "item", + "RestApiId": { + "Ref": "ApiGatewayRestApi" + } + } + }, + "ApiGatewayResourceSubscription": { + "Type": "AWS::ApiGateway::Resource", + "Properties": { + "ParentId": { + "Fn::GetAtt": [ + "ApiGatewayRestApi", + "RootResourceId" + ] + }, + "PathPart": "subscription", + "RestApiId": { + "Ref": "ApiGatewayRestApi" + } + } + }, + "ApiGatewayMethodItemGet": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "GET", + "RequestParameters": {}, + "ResourceId": { + "Ref": "ApiGatewayResourceItem" + }, + "RestApiId": { + "Ref": "ApiGatewayRestApi" + }, + "ApiKeyRequired": false, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:", + { + "Ref": "AWS::Region" + }, + ":lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "HttpGetterLambdaFunction", + "Arn" + ] + }, + "/invocations" + ] + ] + } + }, + "MethodResponses": [] + }, + "DependsOn": [ + "HttpGetterLambdaPermissionApiGateway" + ] + }, + "ApiGatewayMethodSubscriptionPost": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "POST", + "RequestParameters": {}, + "ResourceId": { + "Ref": "ApiGatewayResourceSubscription" + }, + "RestApiId": { + "Ref": "ApiGatewayRestApi" + }, + "ApiKeyRequired": false, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:", + { + "Ref": "AWS::Region" + }, + ":lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "SubscriptionHandlerLambdaFunction", + "Arn" + ] + }, + "/invocations" + ] + ] + } + }, + "MethodResponses": [] + }, + "DependsOn": [ + "SubscriptionHandlerLambdaPermissionApiGateway" + ] + }, + "ApiGatewayDeployment1701242215363": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ApiGatewayRestApi" + }, + "StageName": "dev" + }, + "DependsOn": [ + "ApiGatewayMethodItemGet", + "ApiGatewayMethodSubscriptionPost" + ] + }, + "HttpGetterLambdaPermissionApiGateway": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "FunctionName": { + "Fn::GetAtt": [ + "HttpGetterLambdaFunction", + "Arn" + ] + }, + "Action": "lambda:InvokeFunction", + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "ApiGatewayRestApi" + }, + "/*/*" + ] + ] + } + } + }, + "SubscriptionHandlerLambdaPermissionApiGateway": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "FunctionName": { + "Fn::GetAtt": [ + "SubscriptionHandlerLambdaFunction", + "Arn" + ] + }, + "Action": "lambda:InvokeFunction", + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "ApiGatewayRestApi" + }, + "/*/*" + ] + ] + } + } + }, + "StreamProcessorEventSourceMappingKinesisStream": { + "Type": "AWS::Lambda::EventSourceMapping", + "DependsOn": [ + "IamRoleLambdaExecution" + ], + "Properties": { + "BatchSize": 10, + "Enabled": true, + "EventSourceArn": { + "Fn::GetAtt": [ + "stream", + "Arn" + ] + }, + "FunctionName": { + "Fn::GetAtt": [ + "StreamProcessorLambdaFunction", + "Arn" + ] + }, + "StartingPosition": "LATEST", + "MaximumRetryAttempts": 0 + } + }, + "ServerlesstestprojectdeveventsRulerule1EventBridgeRule": { + "Type": "AWS::Events::Rule", + "Properties": { + "EventPattern": { + "detail-type": [ + "Invoke Lambda Function" + ] + }, + "Name": "serverless-test-project-dev-eventsRule-rule-1", + "State": "ENABLED", + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "EventsRuleLambdaFunction", + "Arn" + ] + }, + "Id": "serverless-test-project-dev-eventsRule-rule-1-target", + "RetryPolicy": { + "MaximumEventAgeInSeconds": 60, + "MaximumRetryAttempts": 2 + } + } + ] + } + }, + "EventsRuleEventBridgeLambdaPermission1": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "EventsRuleLambdaFunction", + "Arn" + ] + }, + "Principal": "events.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + ":", + [ + "arn", + { + "Ref": "AWS::Partition" + }, + "events", + { + "Ref": "AWS::Region" + }, + { + "Ref": "AWS::AccountId" + }, + { + "Fn::Join": [ + "/", + [ + "rule", + "serverless-test-project-dev-eventsRule-rule-1" + ] + ] + } + ] + ] + } + } + }, + "stream": { + "Type": "AWS::Kinesis::Stream", + "Properties": { + "Name": { + "Fn::Sub": "slic-watch-test-project-stream-\${AWS::AccountId}-\${AWS::Region}" + }, + "ShardCount": 1 + } + }, + "bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::Sub": "slic-watch-test-project-bucket-\${AWS::AccountId}-\${AWS::Region}" + } + } + }, + "dataTable": { + "Type": "AWS::DynamoDB::Table", + "DeletionPolicy": "Delete", + "Properties": { + "TableName": "MyTable", + "ProvisionedThroughput": { + "ReadCapacityUnits": 1, + "WriteCapacityUnits": 1 + }, + "AttributeDefinitions": [ + { + "AttributeName": "pk", + "AttributeType": "S" + }, + { + "AttributeName": "sk", + "AttributeType": "S" + }, + { + "AttributeName": "gsi1pk", + "AttributeType": "S" + }, + { + "AttributeName": "gsi1sk", + "AttributeType": "S" + }, + { + "AttributeName": "timestamp", + "AttributeType": "N" + } + ], + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "sk", + "KeyType": "RANGE" + } + ], + "GlobalSecondaryIndexes": [ + { + "IndexName": "GSI1", + "ProvisionedThroughput": { + "ReadCapacityUnits": 1, + "WriteCapacityUnits": 1 + }, + "KeySchema": [ + { + "AttributeName": "gsi1pk", + "KeyType": "HASH" + }, + { + "AttributeName": "gsi1sk", + "KeyType": "RANGE" + } + ], + "Projection": { + "NonKeyAttributes": [ + "address" + ], + "ProjectionType": "INCLUDE" + } + } + ], + "LocalSecondaryIndexes": [ + { + "IndexName": "LSI1", + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "timestamp", + "KeyType": "RANGE" + } + ], + "Projection": { + "NonKeyAttributes": [ + "name" + ], + "ProjectionType": "INCLUDE" + } + } + ] + } + }, + "regularQueue": { + "Type": "AWS::SQS::Queue", + "Properties": { + "QueueName": "SomeRegularQueue" + } + }, + "fifoQueue": { + "Type": "AWS::SQS::Queue", + "Properties": { + "QueueName": "SomeFifoQueue.fifo", + "FifoQueue": true + } + }, + "workflowLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "WorkflowLogs", + "RetentionInDays": 1 + } + }, + "expressWorkflowLogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "ExpressWorkflowLogs", + "RetentionInDays": 1 + } + }, + "vpc": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16" + } + }, + "subnet": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": "eu-west-1a", + "CidrBlock": "10.0.16.0/20", + "VpcId": { + "Ref": "vpc" + } + } + }, + "ecsCluster": { + "Type": "AWS::ECS::Cluster", + "Properties": { + "ClusterName": "awesome-cluster" + } + }, + "ecsService": { + "Type": "AWS::ECS::Service", + "Properties": { + "ServiceName": "awesome-service", + "Cluster": { + "Ref": "ecsCluster" + }, + "DesiredCount": 0, + "LaunchType": "FARGATE", + "TaskDefinition": { + "Ref": "taskDef" + }, + "NetworkConfiguration": { + "AwsvpcConfiguration": { + "AssignPublicIp": "ENABLED", + "SecurityGroups": [], + "Subnets": [ + { + "Ref": "subnet" + } + ] + } + } + } + }, + "taskDef": { + "Type": "AWS::ECS::TaskDefinition", + "Properties": { + "RequiresCompatibilities": [ + "FARGATE" + ], + "Cpu": 256, + "Memory": 512, + "ContainerDefinitions": [ + { + "Name": "busybox", + "Image": "busybox", + "Cpu": 256, + "EntryPoint": [ + "sh", + "-c" + ], + "Memory": 512, + "Command": [ + "/bin/sh -c \\"while true; do echo Hello; sleep 10; done\\"" + ], + "Essential": true + } + ], + "NetworkMode": "awsvpc" + } + }, + "topic": { + "Type": "AWS::SNS::Topic", + "Properties": { + "TopicName": { + "Fn::Sub": "slic-watch-test-project-topic-\${AWS::AccountId}-\${AWS::Region}" + } + } + }, + "subscriptionTest": { + "Type": "AWS::SNS::Subscription", + "Properties": { + "Endpoint": { + "Fn::Sub": "https://\${ApiGatewayRestApi}.execute-api.\${AWS::Region}.amazonaws.com/dev/subscription" + }, + "Protocol": "https", + "TopicArn": { + "Ref": "topic" + } + } + }, + "slicWatchDashboard": { + "Type": "AWS::CloudWatch::Dashboard", + "Properties": { + "DashboardBody": { + "Fn::Sub": { + "start": "-PT3H", + "widgets": [ + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApiGateway", + "5XXError", + "ApiName", + "dev-serverless-test-project", + { + "stat": "Sum" + } + ] + ], + "title": "5XXError API dev-serverless-test-project", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApiGateway", + "5XXError", + "ApiName", + "dev-serverless-test-project", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "4XXError", + "ApiName", + "dev-serverless-test-project", + { + "stat": "Sum" + } + ] + ], + "title": "4XXError API dev-serverless-test-project", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApiGateway", + "5XXError", + "ApiName", + "dev-serverless-test-project", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "4XXError", + "ApiName", + "dev-serverless-test-project", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "Latency", + "ApiName", + "dev-serverless-test-project", + { + "stat": "Average" + } + ], + [ + "AWS/ApiGateway", + "Latency", + "ApiName", + "dev-serverless-test-project", + { + "stat": "p95" + } + ] + ], + "title": "Latency API dev-serverless-test-project", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 0 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ApiGateway", + "5XXError", + "ApiName", + "dev-serverless-test-project", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "4XXError", + "ApiName", + "dev-serverless-test-project", + { + "stat": "Sum" + } + ], + [ + "AWS/ApiGateway", + "Latency", + "ApiName", + "dev-serverless-test-project", + { + "stat": "Average" + } + ], + [ + "AWS/ApiGateway", + "Latency", + "ApiName", + "dev-serverless-test-project", + { + "stat": "p95" + } + ], + [ + "AWS/ApiGateway", + "Count", + "ApiName", + "dev-serverless-test-project", + { + "stat": "Sum" + } + ] + ], + "title": "Count API dev-serverless-test-project", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/States", + "ExecutionsFailed", + "StateMachineArn", + "\${Workflow}", + { + "stat": "Sum" + } + ], + [ + "AWS/States", + "ExecutionThrottled", + "StateMachineArn", + "\${Workflow}", + { + "stat": "Sum" + } + ], + [ + "AWS/States", + "ExecutionsTimedOut", + "StateMachineArn", + "\${Workflow}", + { + "stat": "Sum" + } + ] + ], + "title": "\${Workflow.Name} Step Function Executions", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/States", + "ExecutionsFailed", + "StateMachineArn", + "\${ExpressWorkflow}", + { + "stat": "Sum" + } + ], + [ + "AWS/States", + "ExecutionThrottled", + "StateMachineArn", + "\${ExpressWorkflow}", + { + "stat": "Sum" + } + ], + [ + "AWS/States", + "ExecutionsTimedOut", + "StateMachineArn", + "\${ExpressWorkflow}", + { + "stat": "Sum" + } + ] + ], + "title": "\${ExpressWorkflow.Name} Step Function Executions", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 6 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + { + "stat": "Sum" + } + ] + ], + "title": "ReadThrottleEvents Table \${dataTable}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + "GlobalSecondaryIndex", + "GSI1", + { + "stat": "Sum" + } + ] + ], + "title": "ReadThrottleEvents GSI GSI1 in \${dataTable}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + "GlobalSecondaryIndex", + "GSI1", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "WriteThrottleEvents", + "TableName", + "\${dataTable}", + { + "stat": "Sum" + } + ] + ], + "title": "WriteThrottleEvents Table \${dataTable}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 12 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "ReadThrottleEvents", + "TableName", + "\${dataTable}", + "GlobalSecondaryIndex", + "GSI1", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "WriteThrottleEvents", + "TableName", + "\${dataTable}", + { + "stat": "Sum" + } + ], + [ + "AWS/DynamoDB", + "WriteThrottleEvents", + "TableName", + "\${dataTable}", + "GlobalSecondaryIndex", + "GSI1", + { + "stat": "Sum" + } + ] + ], + "title": "WriteThrottleEvents GSI GSI1 in \${dataTable}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 18 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${HelloLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${PingLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${ThrottlerLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${DriveStreamLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${DriveQueueLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${DriveTableLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${StreamProcessorLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${HttpGetterLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${SubscriptionHandlerLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Errors", + "FunctionName", + "\${EventsRuleLambdaFunction}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Errors Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 18 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${HelloLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${PingLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${ThrottlerLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${DriveStreamLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${DriveQueueLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${DriveTableLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${StreamProcessorLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${HttpGetterLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${SubscriptionHandlerLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Throttles", + "FunctionName", + "\${EventsRuleLambdaFunction}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Throttles Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 18 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HelloLambdaFunction}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${PingLambdaFunction}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${ThrottlerLambdaFunction}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveStreamLambdaFunction}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveQueueLambdaFunction}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveTableLambdaFunction}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${StreamProcessorLambdaFunction}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HttpGetterLambdaFunction}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${SubscriptionHandlerLambdaFunction}", + { + "stat": "Average" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${EventsRuleLambdaFunction}", + { + "stat": "Average" + } + ] + ], + "title": "Lambda Duration Average per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 24 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HelloLambdaFunction}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${PingLambdaFunction}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${ThrottlerLambdaFunction}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveStreamLambdaFunction}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveQueueLambdaFunction}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveTableLambdaFunction}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${StreamProcessorLambdaFunction}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HttpGetterLambdaFunction}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${SubscriptionHandlerLambdaFunction}", + { + "stat": "p95" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${EventsRuleLambdaFunction}", + { + "stat": "p95" + } + ] + ], + "title": "Lambda Duration p95 per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 24 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HelloLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${PingLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${ThrottlerLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveStreamLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveQueueLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveTableLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${StreamProcessorLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${HttpGetterLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${SubscriptionHandlerLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "Duration", + "FunctionName", + "\${EventsRuleLambdaFunction}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda Duration Maximum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 24 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${HelloLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${PingLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${ThrottlerLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${DriveStreamLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${DriveQueueLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${DriveTableLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${StreamProcessorLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${HttpGetterLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${SubscriptionHandlerLambdaFunction}", + { + "stat": "Sum" + } + ], + [ + "AWS/Lambda", + "Invocations", + "FunctionName", + "\${EventsRuleLambdaFunction}", + { + "stat": "Sum" + } + ] + ], + "title": "Lambda Invocations Sum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 30 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${HelloLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${PingLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${ThrottlerLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${DriveStreamLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${DriveQueueLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${DriveTableLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${StreamProcessorLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${HttpGetterLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${SubscriptionHandlerLambdaFunction}", + { + "stat": "Maximum" + } + ], + [ + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${EventsRuleLambdaFunction}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda ConcurrentExecutions Maximum per Function", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 30 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Lambda", + "IteratorAge", + "FunctionName", + "\${StreamProcessorLambdaFunction}", + { + "stat": "Maximum" + } + ] + ], + "title": "Lambda IteratorAge \${StreamProcessorLambdaFunction} Maximum", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 30 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Kinesis", + "GetRecords.IteratorAgeMilliseconds", + "StreamName", + "\${stream}", + { + "stat": "Maximum" + } + ] + ], + "title": "IteratorAge \${stream} Kinesis", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 36 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Kinesis", + "PutRecord.Success", + "StreamName", + "\${stream}", + { + "stat": "Average" + } + ], + [ + "AWS/Kinesis", + "PutRecords.Success", + "StreamName", + "\${stream}", + { + "stat": "Average" + } + ], + [ + "AWS/Kinesis", + "GetRecords.Success", + "StreamName", + "\${stream}", + { + "stat": "Average" + } + ] + ], + "title": "Get/Put Success \${stream} Kinesis", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 36 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Kinesis", + "ReadProvisionedThroughputExceeded", + "StreamName", + "\${stream}", + { + "stat": "Sum" + } + ], + [ + "AWS/Kinesis", + "WriteProvisionedThroughputExceeded", + "StreamName", + "\${stream}", + { + "stat": "Sum" + } + ] + ], + "title": "Provisioned Throughput \${stream} Kinesis", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 36 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "NumberOfMessagesSent", + "QueueName", + "\${regularQueue.QueueName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SQS", + "NumberOfMessagesReceived", + "QueueName", + "\${regularQueue.QueueName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SQS", + "NumberOfMessagesDeleted", + "QueueName", + "\${regularQueue.QueueName}", + { + "stat": "Sum" + } + ] + ], + "title": "Messages \${regularQueue.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 42 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "ApproximateAgeOfOldestMessage", + "QueueName", + "\${regularQueue.QueueName}", + { + "stat": "Maximum" + } + ] + ], + "title": "Oldest Message age \${regularQueue.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 42 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "ApproximateNumberOfMessagesVisible", + "QueueName", + "\${regularQueue.QueueName}", + { + "stat": "Maximum" + } + ] + ], + "title": "Messages in queue \${regularQueue.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 42 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "NumberOfMessagesSent", + "QueueName", + "\${fifoQueue.QueueName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SQS", + "NumberOfMessagesReceived", + "QueueName", + "\${fifoQueue.QueueName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SQS", + "NumberOfMessagesDeleted", + "QueueName", + "\${fifoQueue.QueueName}", + { + "stat": "Sum" + } + ] + ], + "title": "Messages \${fifoQueue.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 48 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "ApproximateAgeOfOldestMessage", + "QueueName", + "\${fifoQueue.QueueName}", + { + "stat": "Maximum" + } + ] + ], + "title": "Oldest Message age \${fifoQueue.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 48 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SQS", + "ApproximateNumberOfMessagesVisible", + "QueueName", + "\${fifoQueue.QueueName}", + { + "stat": "Maximum" + } + ] + ], + "title": "Messages in queue \${fifoQueue.QueueName} SQS", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 48 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ECS", + "MemoryUtilization", + "ServiceName", + "\${ecsService.Name}", + "ClusterName", + "\${ecsCluster}", + { + "stat": "Average" + } + ], + [ + "AWS/ECS", + "CPUUtilization", + "ServiceName", + "\${ecsService.Name}", + "ClusterName", + "\${ecsCluster}", + { + "stat": "Average" + } + ] + ], + "title": "ECS Service \${ecsService.Name}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 0, + "y": 54 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/SNS", + "NumberOfNotificationsFilteredOut-InvalidAttributes", + "TopicName", + "\${topic.TopicName}", + { + "stat": "Sum" + } + ], + [ + "AWS/SNS", + "NumberOfNotificationsFailed", + "TopicName", + "\${topic.TopicName}", + { + "stat": "Sum" + } + ] + ], + "title": "SNS Topic \${topic.TopicName}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 8, + "y": 54 + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/Events", + "FailedInvocations", + "RuleName", + "\${ServerlesstestprojectdeveventsRulerule1EventBridgeRule}", + { + "stat": "Sum" + } + ], + [ + "AWS/Events", + "ThrottledRules", + "RuleName", + "\${ServerlesstestprojectdeveventsRulerule1EventBridgeRule}", + { + "stat": "Sum" + } + ], + [ + "AWS/Events", + "Invocations", + "RuleName", + "\${ServerlesstestprojectdeveventsRulerule1EventBridgeRule}", + { + "stat": "Sum" + } + ] + ], + "title": "EventBridge Rule \${ServerlesstestprojectdeveventsRulerule1EventBridgeRule}", + "view": "timeSeries", + "region": "\${AWS::Region}", + "period": 300 + }, + "width": 8, + "height": 6, + "x": 16, + "y": 54 + } + ] + } + } + } + }, + "slicWatchLambdaErrorsAlarmHelloLambdaFunction": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${HelloLambdaFunction}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${HelloLambdaFunction} breaches 0", + {} + ] + }, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloLambdaFunction" + } + } + ], + "Statistic": "Sum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaThrottlesAlarmHelloLambdaFunction": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${HelloLambdaFunction}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${HelloLambdaFunction} breaches 0", + {} + ] + }, + "Metrics": [ + { + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true + }, + { + "Id": "throttles", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Throttles", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloLambdaFunction" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloLambdaFunction" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 0 + } + }, + "slicWatchLambdaDurationAlarmHelloLambdaFunction": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${HelloLambdaFunction}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${HelloLambdaFunction} breaches 95% of timeout (6)", + {} + ] + }, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloLambdaFunction" + } + } + ], + "Statistic": "Maximum", + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Threshold": 5700 + } + }, + "slicWatchApi5XXErrorAlarmdevserverlesstestproject": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ApiGW_5XXError_dev-serverless-test-project", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "API Gateway 5XXError Average for dev-serverless-test-project breaches 0", + {} + ] + }, + "MetricName": "5XXError", + "Namespace": "AWS/ApiGateway", + "Dimensions": [ + { + "Name": "ApiName", + "Value": "dev-serverless-test-project" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 0 + } + }, + "slicWatchApi4XXErrorAlarmdevserverlesstestproject": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ApiGW_4XXError_dev-serverless-test-project", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "API Gateway 4XXError Average for dev-serverless-test-project breaches 0.05", + {} + ] + }, + "MetricName": "4XXError", + "Namespace": "AWS/ApiGateway", + "Dimensions": [ + { + "Name": "ApiName", + "Value": "dev-serverless-test-project" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 0.05 + } + }, + "slicWatchApiLatencyAlarmdevserverlesstestproject": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ApiGW_Latency_dev-serverless-test-project", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "API Gateway Latency p99 for dev-serverless-test-project breaches 5000", + {} + ] + }, + "MetricName": "Latency", + "Namespace": "AWS/ApiGateway", + "Dimensions": [ + { + "Name": "ApiName", + "Value": "dev-serverless-test-project" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "ExtendedStatistic": "p99", + "Threshold": 5000 + } + }, + "slicWatchStatesExecutionThrottledAlarmWorkflow": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "Workflow" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionThrottledAlarm_\${Workflow.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionThrottled Sum for \${Workflow.Name} breaches 0", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchStatesExecutionsFailedAlarmWorkflow": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "Workflow" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionsFailedAlarm_\${Workflow.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionsFailed Sum for \${Workflow.Name} breaches 0", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchStatesExecutionsTimedOutAlarmWorkflow": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "MetricName": "ExecutionsTimedOut", + "Namespace": "AWS/States", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "Workflow" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionsTimedOutAlarm_\${Workflow.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionsTimedOut Sum for \${Workflow.Name} breaches 0", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchStatesExecutionThrottledAlarmExpressWorkflow": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "ExpressWorkflow" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionThrottledAlarm_\${ExpressWorkflow.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionThrottled Sum for \${ExpressWorkflow.Name} breaches 0", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchStatesExecutionsFailedAlarmExpressWorkflow": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "ExpressWorkflow" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionsFailedAlarm_\${ExpressWorkflow.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionsFailed Sum for \${ExpressWorkflow.Name} breaches 0", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchStatesExecutionsTimedOutAlarmExpressWorkflow": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "MetricName": "ExecutionsTimedOut", + "Namespace": "AWS/States", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "ExpressWorkflow" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionsTimedOutAlarm_\${ExpressWorkflow.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionsTimedOut Sum for \${ExpressWorkflow.Name} breaches 0", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchTableReadThrottleEventsAlarmdataTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_ReadThrottleEvents_Alarm_\${dataTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable} breaches 10", + {} + ] + }, + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchTableWriteThrottleEventsAlarmdataTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_WriteThrottleEvents_Alarm_\${dataTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable} breaches 10", + {} + ] + }, + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchTableUserErrorsAlarmdataTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_UserErrors_Alarm_\${dataTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable} breaches 0", + {} + ] + }, + "MetricName": "UserErrors", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchTableSystemErrorsAlarmdataTable": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_SystemErrors_Alarm_\${dataTable}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable} breaches 0", + {} + ] + }, + "MetricName": "SystemErrors", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchGSIReadThrottleEventsAlarmdataTableGSI1": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_ReadThrottleEvents_Alarm_\${dataTable}GSI1", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable}GSI1 breaches 10", + {} + ] + }, + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + }, + { + "Name": "GlobalSecondaryIndex", + "Value": "GSI1" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchGSIWriteThrottleEventsAlarmdataTableGSI1": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "DDB_WriteThrottleEvents_Alarm_\${dataTable}GSI1", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable}GSI1 breaches 10", + {} + ] + }, + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + }, + { + "Name": "GlobalSecondaryIndex", + "Value": "GSI1" + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 10 + } + }, + "slicWatchKinesisStreamIteratorAgeAlarmStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamIteratorAge_\${stream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Maximum GetRecords.IteratorAgeMilliseconds for \${stream} breaches 10000 milliseconds", + {} + ] + }, + "MetricName": "GetRecords.IteratorAgeMilliseconds", + "Namespace": "AWS/Kinesis", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Maximum", + "Threshold": 10000 + } + }, + "slicWatchKinesisStreamReadThroughputAlarmStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamReadThroughput_\${stream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Sum ReadProvisionedThroughputExceeded for \${stream} breaches 0 milliseconds", + {} + ] + }, + "MetricName": "ReadProvisionedThroughputExceeded", + "Namespace": "AWS/Kinesis", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchKinesisStreamWriteThroughputAlarmStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamWriteThroughput_\${stream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Sum WriteProvisionedThroughputExceeded for \${stream} breaches 0 milliseconds", + {} + ] + }, + "MetricName": "WriteProvisionedThroughputExceeded", + "Namespace": "AWS/Kinesis", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 0 + } + }, + "slicWatchKinesisStreamPutRecordSuccessAlarmStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamPutRecordSuccess_\${stream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Average PutRecord.Success for \${stream} breaches 1 milliseconds", + {} + ] + }, + "MetricName": "PutRecord.Success", + "Namespace": "AWS/Kinesis", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "LessThanThreshold", + "Statistic": "Average", + "Threshold": 1 + } + }, + "slicWatchKinesisStreamPutRecordsSuccessAlarmStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamPutRecordsSuccess_\${stream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Average PutRecords.Success for \${stream} breaches 1 milliseconds", + {} + ] + }, + "MetricName": "PutRecords.Success", + "Namespace": "AWS/Kinesis", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "LessThanThreshold", + "Statistic": "Average", + "Threshold": 1 + } + }, + "slicWatchKinesisStreamGetRecordsSuccessAlarmStream": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamGetRecordsSuccess_\${stream}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Average GetRecords.Success for \${stream} breaches 1 milliseconds", + {} + ] + }, + "MetricName": "GetRecords.Success", + "Namespace": "AWS/Kinesis", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "LessThanThreshold", + "Statistic": "Average", + "Threshold": 1 + } + }, + "slicWatchSQSInFlightMsgsAlarmregularQueue": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateNumberOfMessagesNotVisible_\${regularQueue.QueueName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SQS in-flight messages for \${regularQueue.QueueName} breaches 96000 (80% of the hard limit of 120000)", + {} + ] + }, + "MetricName": "ApproximateNumberOfMessagesNotVisible", + "Namespace": "AWS/SQS", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "regularQueue", + "QueueName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Maximum", + "Threshold": 96000 + } + }, + "slicWatchSQSInFlightMsgsAlarmfifoQueue": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateNumberOfMessagesNotVisible_\${fifoQueue.QueueName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SQS in-flight messages for \${fifoQueue.QueueName} breaches 16000 (80% of the hard limit of 20000)", + {} + ] + }, + "MetricName": "ApproximateNumberOfMessagesNotVisible", + "Namespace": "AWS/SQS", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "fifoQueue", + "QueueName" + ] + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Maximum", + "Threshold": 16000 + } + }, + "slicWatchECSMemoryAlarmecsService": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ECS_MemoryAlarm_\${ecsService.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "ECS MemoryUtilization for \${ecsService.Name} breaches 90", + {} + ] + }, + "MetricName": "MemoryUtilization", + "Namespace": "AWS/ECS", + "Dimensions": [ + { + "Name": "ServiceName", + "Value": { + "Fn::GetAtt": [ + "ecsService", + "Name" + ] + } + }, + { + "Name": "ClusterName", + "Value": { + "Ref": "ecsCluster" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 90 + } + }, + "slicWatchECSCPUAlarmecsService": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "AlarmName": { + "Fn::Sub": [ + "ECS_CPUAlarm_\${ecsService.Name}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "ECS CPUUtilization for \${ecsService.Name} breaches 90", + {} + ] + }, + "MetricName": "CPUUtilization", + "Namespace": "AWS/ECS", + "Dimensions": [ + { + "Name": "ServiceName", + "Value": { + "Fn::GetAtt": [ + "ecsService", + "Name" + ] + } + }, + { + "Name": "ClusterName", + "Value": { + "Ref": "ecsCluster" + } + } + ], + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Average", + "Threshold": 90 + } + }, + "slicWatchSNSNumberOfNotificationsFilteredOutInvalidAttributesAlarmTopic": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "MetricName": "NumberOfNotificationsFilteredOut-InvalidAttributes", + "Namespace": "AWS/SNS", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "topic", + "TopicName" + ] + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFilteredOutInvalidAttributes_Alarm_\${topic.TopicName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFilteredOutInvalidAttributes for \${topic.TopicName} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchSNSNumberOfNotificationsFailedAlarmTopic": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "MetricName": "NumberOfNotificationsFailed", + "Namespace": "AWS/SNS", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "topic", + "TopicName" + ] + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFailed_Alarm_\${topic.TopicName}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFailed for \${topic.TopicName} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchEventsFailedInvocationsAlarmServerlesstestprojectdeveventsRulerule1EventBridgeRule": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "MetricName": "FailedInvocations", + "Namespace": "AWS/Events", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "ServerlesstestprojectdeveventsRulerule1EventBridgeRule" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "Events_FailedInvocations_Alarm_\${ServerlesstestprojectdeveventsRulerule1EventBridgeRule}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge FailedInvocations for \${ServerlesstestprojectdeveventsRulerule1EventBridgeRule} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + }, + "slicWatchEventsThrottledRulesAlarmServerlesstestprojectdeveventsRulerule1EventBridgeRule": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "OKActions": [], + "MetricName": "ThrottledRules", + "Namespace": "AWS/Events", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "ServerlesstestprojectdeveventsRulerule1EventBridgeRule" + } + } + ], + "AlarmName": { + "Fn::Sub": [ + "Events_ThrottledRules_Alarm_\${ServerlesstestprojectdeveventsRulerule1EventBridgeRule}", + {} + ] + }, + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge ThrottledRules for \${ServerlesstestprojectdeveventsRulerule1EventBridgeRule} breaches 1", + {} + ] + }, + "Period": 60, + "EvaluationPeriods": 1, + "TreatMissingData": "notBreaching", + "ComparisonOperator": "GreaterThanThreshold", + "Statistic": "Sum", + "Threshold": 1 + } + } + }, + "Outputs": { + "ServerlessDeploymentBucketName": { + "Value": { + "Ref": "ServerlessDeploymentBucket" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-ServerlessDeploymentBucketName" + } + }, + "HelloLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "HelloLambdaVersioncvZrQjYr4FdYsM3CaTj5TKuOJmUjyL07tfIDVXBSw4" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-HelloLambdaFunctionQualifiedArn" + } + }, + "PingLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "PingLambdaVersionSQcuddhSFqI0xKYCyuQTTJMvwrlKCB77CNQ16xyQ" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-PingLambdaFunctionQualifiedArn" + } + }, + "ThrottlerLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "ThrottlerLambdaVersion0UeWLgxZYywcyV3gGiutpyCQJEbO6Gk8zSSOP7dMEps" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-ThrottlerLambdaFunctionQualifiedArn" + } + }, + "DriveStreamLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "DriveStreamLambdaVersionsWkqlV7IV7mJdqIqQToVljMizTzZoDCso7qMazjI" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-DriveStreamLambdaFunctionQualifiedArn" + } + }, + "DriveQueueLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "DriveQueueLambdaVersionTmzx8HCxfunJ3etrLOOYLg8zG05MzRauykeVpZFz8WY" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-DriveQueueLambdaFunctionQualifiedArn" + } + }, + "DriveTableLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "DriveTableLambdaVersionkqI0DCnUasgza04mnCpqj0q5vePTOojYtyi4hxfE3ME" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-DriveTableLambdaFunctionQualifiedArn" + } + }, + "StreamProcessorLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "StreamProcessorLambdaVersion24Kwch4oq5ogXKcIDJuLGB1qAJWt8aqgW43aCjKI" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-StreamProcessorLambdaFunctionQualifiedArn" + } + }, + "HttpGetterLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "HttpGetterLambdaVersionvK2ALwc1DFqBccIyulxoBU3GveALO98nQc2xP94J8" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-HttpGetterLambdaFunctionQualifiedArn" + } + }, + "SubscriptionHandlerLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "SubscriptionHandlerLambdaVersion4kKEYaIgWsMN0XYzRQn4VAailfQcZ23kdSSOKepfB4A" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-SubscriptionHandlerLambdaFunctionQualifiedArn" + } + }, + "EventsRuleLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "EventsRuleLambdaVersionxBuN447jfeozyKD2CEV3oCIHhShTUOVe5XKOkBlbchQ" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-EventsRuleLambdaFunctionQualifiedArn" + } + }, + "WorkflowArn": { + "Description": "Current StateMachine Arn", + "Value": { + "Ref": "Workflow" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-WorkflowArn" + } + }, + "ExpressWorkflowArn": { + "Description": "Current StateMachine Arn", + "Value": { + "Ref": "ExpressWorkflow" + }, + "Export": { + "Name": "sls-serverless-test-project-dev-ExpressWorkflowArn" + } + }, + "ServiceEndpoint": { + "Description": "URL of the service endpoint", + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "ApiGatewayRestApi" + }, + ".execute-api.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/dev" + ] + ] + }, + "Export": { + "Name": "sls-serverless-test-project-dev-ServiceEndpoint" + } + } + } +} +` diff --git a/test-utils/package.json b/test-utils/package.json new file mode 100755 index 00000000..28059e89 --- /dev/null +++ b/test-utils/package.json @@ -0,0 +1,15 @@ +{ + "name": "test-utils", + "description": "Common test utilities", + "version": "3.1.0", + "repository": { + "type": "git", + "url": "https://github.com/fourTheorem/slic-watch.git", + "directory": "test-utils" + }, + "license": "Apache", + "dependencies": {}, + "scripts": { + "test": "echo" + } +} diff --git a/test-utils/sls-test-utils.ts b/test-utils/sls-test-utils.ts new file mode 100644 index 00000000..2adf1442 --- /dev/null +++ b/test-utils/sls-test-utils.ts @@ -0,0 +1,59 @@ +import { type Template } from 'cloudform' +import pino from 'pino' + +// Serverless Framework provides plugins with a logger to use, so we simulate that with this: +export const dummyLogger = Object.assign({}, pino()) +const extras = ['levels', 'silent', 'onChild', 'trace', 'debug', 'info', 'warn', 'error', 'fatal'] +for (const extra of extras) { + // eslint-disable-next-line @typescript-eslint/no-dynamic-delete + delete dummyLogger[extra] +} +export const pluginUtils = { log: dummyLogger } + +export interface SlsYaml { + custom? + functions? +} + +export const slsYaml: SlsYaml = { + custom: { + slicWatch: { + topicArn: 'test-topic', + enabled: true + } + }, + functions: { + hello: { + } + } +} + +export function createMockServerless (compiledTemplate: Template) { + return { + cli: { + log: () => { '' } + }, + providers: { aws: {} }, + getProvider: () => ({ + naming: { + getLambdaLogicalId: (funcName: string) => { + return funcName[0].toUpperCase() + funcName.slice(1) + 'LambdaFunction' + } + } + }), + service: { + provider: { + name: 'aws', + compiledCloudFormationTemplate: compiledTemplate + }, + custom: { + slicWatch: { + enabled: true, + topicArn: 'test-topic' + } + }, + getAllFunctions: () => Object.keys(slsYaml.functions), + getFunction: (funcRef) => slsYaml.functions[funcRef] + } + } +} diff --git a/test-utils/snapshot-utils.ts b/test-utils/snapshot-utils.ts new file mode 100644 index 00000000..d1f403ec --- /dev/null +++ b/test-utils/snapshot-utils.ts @@ -0,0 +1,51 @@ +import type { Template } from 'cloudform' + +import type { DashboardProperties } from 'cloudform-types/types/cloudWatch/dashboard' +import { type ResourceType } from 'slic-watch-core/cf-template' +import { type Test } from 'tap' +/** + * node-tap snapshots are usually persisted in tcompare format. We replace this with JSON + * so we can clean them and deal with JSON-within-JSON cases. + * + * @param template CloudFormation Template to be used as a snapshot + * @returns The formatted snapshot + */ +export function formatSnapshot (template: Template): string { + return JSON.stringify(template, null, ' ') +} + +/** + * Sanitise CloudFormation template snapshots so the dashboard JSON is extracted, allowing + * snapshot differences to be more readable + * + * @param snapshot The CloudFormation template snapshot + */ +export function cleanSnapshot (snapshot: string): string { + const snapshotTemplate = JSON.parse(snapshot) as Template + const cleanTemplate = { ...snapshotTemplate } + cleanTemplate.Resources = Object.fromEntries(Object.entries(snapshotTemplate.Resources as ResourceType).map( + ([key, value]) => { + const resource = value + if (resource.Type === 'AWS::CloudWatch::Dashboard') { + const dashBody = (resource.Properties as DashboardProperties).DashboardBody + const subValue = dashBody['Fn::Sub'] + const parsedValue = JSON.parse(subValue) + return [key, { + ...(value as object), + Properties: { + DashboardBody: { + 'Fn::Sub': parsedValue + } + } + }] + } + return [key, value] + }) + ) + return JSON.stringify(cleanTemplate, null, ' ') +} + +export function setUpSnapshotDefaults (t: Test) { + t.formatSnapshot = formatSnapshot + t.cleanSnapshot = cleanSnapshot +} diff --git a/tsconfig.json b/tsconfig.json index c026ead6..c907461d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "esm": true, "compilerOptions": { + "allowJs": true, "module": "commonjs", "strict": true, "noImplicitAny": false, @@ -29,6 +30,12 @@ "include": [ "core", "serverless-plugin", - "cf-macro" + "cf-macro", + "serverless-test-project/tests", + "serverless-test-project-alb/tests", + "serverless-test-project-appsync/tests", + "sam-test-project/tests", + "cdk-test-project", + "test-utils" ] } \ No newline at end of file