From 1c48c8c78e388c3b77926559d34b2027e1a2d171 Mon Sep 17 00:00:00 2001 From: Eoin Shanaghy Date: Fri, 1 Dec 2023 13:55:47 +0000 Subject: [PATCH] chore: sort snapshots by key --- cf-macro/index.ts | 2 +- ...cdk-test-project-snapshot.test.ts.test.cjs | 12824 ++++++++-------- ...sam-test-project-snapshot.test.ts.test.cjs | 8890 +++++------ ...test-project-alb-snapshot.test.ts.test.cjs | 1014 +- ...-project-appsync-snapshot.test.ts.test.cjs | 938 +- ...ess-test-project-snapshot.test.ts.test.cjs | 3746 ++--- test-utils/sls-test-utils.ts | 2 +- test-utils/snapshot-utils.ts | 20 +- 8 files changed, 13726 insertions(+), 13710 deletions(-) diff --git a/cf-macro/index.ts b/cf-macro/index.ts index 95920451..265af8aa 100644 --- a/cf-macro/index.ts +++ b/cf-macro/index.ts @@ -6,7 +6,7 @@ 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', level: process.env.DEBUG_LEVEL ?? 'DEBUG' }) +const logger = pino({ name: 'macroHandler', level: process.env.DEBUG_LEVEL ?? 'debug' }) setLogger(logger) 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 index dc991fd9..75170058 100644 --- 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 @@ -7,10 +7,8 @@ 'use strict' exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP > the Macro adds SLIC Watch dashboards and alarms to synthesized CDK project > ecsStack > ecsStack fragment 1`] = ` { - "Transform": "SlicWatch-v3", "Metadata": { "slicWatch": { - "enabled": true, "alarms": { "Lambda": { "Invocations": { @@ -20,8 +18,8 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP }, "SQS": { "AgeOfOldestMessage": { - "Statistic": "Maximum", "enabled": true, + "Statistic": "Maximum", "Threshold": 60 }, "InFlightMessagesPc": { @@ -29,399 +27,349 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Threshold": 1 } } + }, + "enabled": true + } + }, + "Outputs": { + "MyWebServerLoadBalancerDNSD1AFCC81": { + "Value": { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "DNSName" + ] + } + }, + "MyWebServerServiceURLB0ED50F6": { + "Value": { + "Fn::Join": [ + "", + [ + "http://", + { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "DNSName" + ] + } + ] + ] } } }, + "Parameters": { + "BootstrapVersion": { + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]", + "Type": "AWS::SSM::Parameter::Value" + } + }, "Resources": { - "MyWebServerLB3B5FD3AB": { - "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", + "CDKMetadata": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/CDKMetadata/Default" + }, "Properties": { - "LoadBalancerAttributes": [ - { - "Key": "deletion_protection.enabled", - "Value": "false" - } - ], - "Scheme": "internet-facing", - "SecurityGroups": [ + "Analytics": "v2:deflate64:H4sIAAAAAAAA/31Ry27CMBD8Fu7GbTlUXCmlCAm1UYK4IsfZpgvBjux1EIry73WepLSqFGlnx+PsembG58/8cSIudiqT0zTDmJcRCXlinjqUIO0hF0RglOWLPM9QCkKttlokLyITSkLyJkwqCCIwBUpgkAlLKDOviBsFqrSY8fLv24YtP3/2Yx1aAtVpejw63/nJQGujXV5LRm3FQPqZEUhnkK6D5H9ilRqw9he9US2/z2V9tg+WLHCxXyJysQJq9AMKtSPYiTiDG3/jFtZqic3yg7gGq01Ql3dBa2/lRVxZYLCoXR1+vFF1CjAI2k26bkE+s68zKKpfbnnZhbIT9vQKn6iwH3nPaEUCva8j7i7Qxo4OZs6n0OTRwYqhOPMy1O17mxpo702zYIsqlunU77TV6eB7j6uq7j4c5Y5YCFY7047sccWUToAf7UPxNOf+m02OFnFqnCI8Aw/b+g3+NWTOyAIAAA==" + }, + "Type": "AWS::CDK::Metadata" + }, + "EcsDefaultClusterMnL3mNNYN926A5246": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Resource" + }, + "Type": "AWS::ECS::Cluster" + }, + "EcsDefaultClusterMnL3mNNYNVpc7788A521": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/Resource" + }, + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ { - "Fn::GetAtt": [ - "MyWebServerLBSecurityGroup01B285AA", - "GroupId" - ] + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc" } - ], - "Subnets": [ - { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99" - }, + ] + }, + "Type": "AWS::EC2::VPC" + }, + "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/IGW" + }, + "Properties": { + "Tags": [ { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A" + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc" } - ], - "Type": "application" + ] }, - "DependsOn": [ - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178", - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableAssociation8B583A17", - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520", - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTableAssociation43E5803C" - ], + "Type": "AWS::EC2::InternetGateway" + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1DefaultRouteA5ADF694": { "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/Resource" - } + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/DefaultRoute" + }, + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1NATGateway5E3732C1" + }, + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36" + } + }, + "Type": "AWS::EC2::Route" }, - "MyWebServerLBSecurityGroup01B285AA": { - "Type": "AWS::EC2::SecurityGroup", + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/RouteTable" + }, "Properties": { - "GroupDescription": "Automatically created Security Group for ELB CdkECSStackTestEuropeMyWebServerLBE298D4B6", - "SecurityGroupIngress": [ + "Tags": [ { - "CidrIp": "0.0.0.0/0", - "Description": "Allow from anyone on port 80", - "FromPort": 80, - "IpProtocol": "tcp", - "ToPort": 80 + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1" } ], "VpcId": { "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" } }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/SecurityGroup/Resource" - } + "Type": "AWS::EC2::RouteTable" }, - "MyWebServerLBSecurityGrouptoCdkECSStackTestEuropeMyWebServerServiceSecurityGroup792A2ECD807CF0A9FB": { - "Type": "AWS::EC2::SecurityGroupEgress", + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTableAssociation34B92275": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/RouteTableAssociation" + }, "Properties": { - "GroupId": { - "Fn::GetAtt": [ - "MyWebServerLBSecurityGroup01B285AA", - "GroupId" - ] - }, - "IpProtocol": "tcp", - "Description": "Load balancer to target", - "DestinationSecurityGroupId": { - "Fn::GetAtt": [ - "MyWebServerServiceSecurityGroup6788214A", - "GroupId" - ] + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36" }, - "FromPort": 80, - "ToPort": 80 + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C" + } }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/SecurityGroup/to CdkECSStackTestEuropeMyWebServerServiceSecurityGroup792A2ECD:80" - } + "Type": "AWS::EC2::SubnetRouteTableAssociation" }, - "MyWebServerLBPublicListener03D7C493": { - "Type": "AWS::ElasticLoadBalancingV2::Listener", + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/Subnet" + }, "Properties": { - "DefaultActions": [ + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ { - "TargetGroupArn": { - "Ref": "MyWebServerLBPublicListenerECSGroup5AB9F1C3" - }, - "Type": "forward" + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1" } ], - "LoadBalancerArn": { - "Ref": "MyWebServerLB3B5FD3AB" + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + } + }, + "Type": "AWS::EC2::Subnet" + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2DefaultRoute20CE2D89": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/DefaultRoute" + }, + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2NATGateway4C855E00" }, - "Port": 80, - "Protocol": "HTTP" + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591" + } }, + "Type": "AWS::EC2::Route" + }, + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableAssociation111C622F": { "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/PublicListener/Resource" - } + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/RouteTableAssociation" + }, + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591" + }, + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73" + } + }, + "Type": "AWS::EC2::SubnetRouteTableAssociation" }, - "MyWebServerLBPublicListenerECSGroup5AB9F1C3": { - "Type": "AWS::ElasticLoadBalancingV2::TargetGroup", + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/RouteTable" + }, "Properties": { - "Port": 80, - "Protocol": "HTTP", - "TargetGroupAttributes": [ + "Tags": [ { - "Key": "stickiness.enabled", - "Value": "false" + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2" } ], - "TargetType": "ip", "VpcId": { "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" } }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/PublicListener/ECSGroup/Resource" - } + "Type": "AWS::EC2::RouteTable" }, - "MyWebServerTaskDefTaskRoleB23C17AA": { - "Type": "AWS::IAM::Role", + "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/Subnet" + }, "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ + "AvailabilityZone": { + "Fn::Select": [ + 1, { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } + "Fn::GetAZs": "" } - ], - "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" + "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" + } ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "MyWebServerTaskDefTaskRoleB23C17AA", - "Arn" - ] + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" } }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/Resource" - } + "Type": "AWS::EC2::Subnet" }, - "MyWebServerTaskDefwebLogGroupC6EE23D4": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178": { + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcVPCGW2447264E" + ], "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/web/LogGroup/Resource" - } - }, - "MyWebServerTaskDefExecutionRole3C69E361": { - "Type": "AWS::IAM::Role", + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/DefaultRoute" + }, "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F" + }, + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC" } }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/ExecutionRole/Resource" - } + "Type": "AWS::EC2::Route" }, - "MyWebServerTaskDefExecutionRoleDefaultPolicy2AEB4329": { - "Type": "AWS::IAM::Policy", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1EIP8704DB2F": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/EIP" + }, "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "MyWebServerTaskDefwebLogGroupC6EE23D4", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "MyWebServerTaskDefExecutionRoleDefaultPolicy2AEB4329", - "Roles": [ + "Domain": "vpc", + "Tags": [ { - "Ref": "MyWebServerTaskDefExecutionRole3C69E361" + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" } ] }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/ExecutionRole/DefaultPolicy/Resource" - } + "Type": "AWS::EC2::EIP" }, - "MyWebServerService2FE7341D": { - "Type": "AWS::ECS::Service", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1NATGateway5E3732C1": { + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableAssociation8B583A17" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/NATGateway" + }, "Properties": { - "Cluster": { - "Ref": "EcsDefaultClusterMnL3mNNYN926A5246" + "AllocationId": { + "Fn::GetAtt": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1EIP8704DB2F", + "AllocationId" + ] }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 50 + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99" }, - "EnableECSManagedTags": false, - "HealthCheckGracePeriodSeconds": 60, - "LaunchType": "FARGATE", - "LoadBalancers": [ + "Tags": [ { - "ContainerName": "web", - "ContainerPort": 80, - "TargetGroupArn": { - "Ref": "MyWebServerLBPublicListenerECSGroup5AB9F1C3" - } - } - ], - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "MyWebServerServiceSecurityGroup6788214A", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C" - }, - { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73" - } - ] + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" } - }, - "TaskDefinition": { - "Ref": "MyWebServerTaskDef4CE825A0" - } + ] }, - "DependsOn": [ - "MyWebServerLBPublicListenerECSGroup5AB9F1C3", - "MyWebServerLBPublicListener03D7C493", - "MyWebServerTaskDefTaskRoleB23C17AA" - ], - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/Service/Service" - } + "Type": "AWS::EC2::NatGateway" }, - "MyWebServerServiceSecurityGroup6788214A": { - "Type": "AWS::EC2::SecurityGroup", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/RouteTable" + }, "Properties": { - "GroupDescription": "CdkECSStackTest-Europe/MyWebServer/Service/SecurityGroup", - "SecurityGroupEgress": [ + "Tags": [ { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" } ], "VpcId": { "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" } }, - "DependsOn": [ - "MyWebServerTaskDefTaskRoleB23C17AA" - ], - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/Service/SecurityGroup/Resource" - } + "Type": "AWS::EC2::RouteTable" }, - "MyWebServerServiceSecurityGroupfromCdkECSStackTestEuropeMyWebServerLBSecurityGroup8823910380E44CF71E": { - "Type": "AWS::EC2::SecurityGroupIngress", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableAssociation8B583A17": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/RouteTableAssociation" + }, "Properties": { - "IpProtocol": "tcp", - "Description": "Load balancer to target", - "FromPort": 80, - "GroupId": { - "Fn::GetAtt": [ - "MyWebServerServiceSecurityGroup6788214A", - "GroupId" - ] - }, - "SourceSecurityGroupId": { - "Fn::GetAtt": [ - "MyWebServerLBSecurityGroup01B285AA", - "GroupId" - ] + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC" }, - "ToPort": 80 + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99" + } }, - "DependsOn": [ - "MyWebServerTaskDefTaskRoleB23C17AA" - ], - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/Service/SecurityGroup/from CdkECSStackTestEuropeMyWebServerLBSecurityGroup88239103:80" - } + "Type": "AWS::EC2::SubnetRouteTableAssociation" }, - "EcsDefaultClusterMnL3mNNYN926A5246": { - "Type": "AWS::ECS::Cluster", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99": { "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" - } - ] + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/Subnet" }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/Resource" - } - }, - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99": { - "Type": "AWS::EC2::Subnet", "Properties": { - "VpcId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" - }, "AvailabilityZone": { "Fn::Select": [ 0, @@ -445,109 +393,109 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "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" - } + "Type": "AWS::EC2::Subnet" }, - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178": { - "Type": "AWS::EC2::Route", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520": { + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcVPCGW2447264E" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/DefaultRoute" + }, "Properties": { - "RouteTableId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableA1FD6ACC" - }, "DestinationCidrBlock": "0.0.0.0/0", "GatewayId": { "Ref": "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F" + }, + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5" } }, - "DependsOn": [ - "EcsDefaultClusterMnL3mNNYNVpcVPCGW2447264E" - ], - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/DefaultRoute" - } + "Type": "AWS::EC2::Route" }, - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1EIP8704DB2F": { - "Type": "AWS::EC2::EIP", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2EIPF0764873": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/EIP" + }, "Properties": { "Domain": "vpc", "Tags": [ { "Key": "Name", - "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" } ] }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/EIP" - } + "Type": "AWS::EC2::EIP" }, - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1NATGateway5E3732C1": { - "Type": "AWS::EC2::NatGateway", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2NATGateway4C855E00": { + "DependsOn": [ + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTableAssociation43E5803C" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/NATGateway" + }, "Properties": { - "SubnetId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99" - }, "AllocationId": { "Fn::GetAtt": [ - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1EIP8704DB2F", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2EIPF0764873", "AllocationId" ] }, + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A" + }, "Tags": [ { "Key": "Name", - "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1" + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" } ] }, - "DependsOn": [ - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178", - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableAssociation8B583A17" - ], - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet1/NATGateway" - } + "Type": "AWS::EC2::NatGateway" }, - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A": { - "Type": "AWS::EC2::Subnet", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/RouteTable" + }, "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" + } + ], "VpcId": { "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + } + }, + "Type": "AWS::EC2::RouteTable" + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTableAssociation43E5803C": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/RouteTableAssociation" + }, + "Properties": { + "RouteTableId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5" }, + "SubnetId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A" + } + }, + "Type": "AWS::EC2::SubnetRouteTableAssociation" + }, + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/Subnet" + }, + "Properties": { "AvailabilityZone": { "Fn::Select": [ 1, @@ -571,528 +519,387 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "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" - } + "Type": "AWS::EC2::Subnet" }, - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520": { - "Type": "AWS::EC2::Route", + "EcsDefaultClusterMnL3mNNYNVpcVPCGW2447264E": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/VPCGW" + }, "Properties": { - "RouteTableId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTable263DEAA5" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { + "InternetGatewayId": { "Ref": "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F" + }, + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" } }, + "Type": "AWS::EC2::VPCGatewayAttachment" + }, + "MyWebServerLB3B5FD3AB": { "DependsOn": [ - "EcsDefaultClusterMnL3mNNYNVpcVPCGW2447264E" + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1DefaultRouteFF4E2178", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1RouteTableAssociation8B583A17", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520", + "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTableAssociation43E5803C" ], "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/DefaultRoute" - } - }, - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2EIPF0764873": { - "Type": "AWS::EC2::EIP", + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/Resource" + }, "Properties": { - "Domain": "vpc", - "Tags": [ + "LoadBalancerAttributes": [ { - "Key": "Name", - "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" + "Key": "deletion_protection.enabled", + "Value": "false" } - ] - }, - "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": [ + ], + "Scheme": "internet-facing", + "SecurityGroups": [ { - "Key": "Name", - "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2" + "Fn::GetAtt": [ + "MyWebServerLBSecurityGroup01B285AA", + "GroupId" + ] } - ] + ], + "Subnets": [ + { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1Subnet3C273B99" + }, + { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2Subnet95FF715A" + } + ], + "Type": "application" }, - "DependsOn": [ - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2DefaultRouteB1375520", - "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2RouteTableAssociation43E5803C" - ], - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PublicSubnet2/NATGateway" - } + "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer" }, - "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C": { - "Type": "AWS::EC2::Subnet", + "MyWebServerLBPublicListener03D7C493": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/PublicListener/Resource" + }, "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" - }, + "DefaultActions": [ { - "Key": "Name", - "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1" + "TargetGroupArn": { + "Ref": "MyWebServerLBPublicListenerECSGroup5AB9F1C3" + }, + "Type": "forward" } - ] + ], + "LoadBalancerArn": { + "Ref": "MyWebServerLB3B5FD3AB" + }, + "Port": 80, + "Protocol": "HTTP" }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/Subnet" - } + "Type": "AWS::ElasticLoadBalancingV2::Listener" }, - "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36": { - "Type": "AWS::EC2::RouteTable", + "MyWebServerLBPublicListenerECSGroup5AB9F1C3": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/PublicListener/ECSGroup/Resource" + }, "Properties": { - "VpcId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" - }, - "Tags": [ + "Port": 80, + "Protocol": "HTTP", + "TargetGroupAttributes": [ { - "Key": "Name", - "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1" + "Key": "stickiness.enabled", + "Value": "false" } - ] - }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/RouteTable" - } - }, - "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTableAssociation34B92275": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36" - }, - "SubnetId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C" + ], + "TargetType": "ip", + "VpcId": { + "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" } }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/RouteTableAssociation" - } + "Type": "AWS::ElasticLoadBalancingV2::TargetGroup" }, - "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1DefaultRouteA5ADF694": { - "Type": "AWS::EC2::Route", + "MyWebServerLBSecurityGroup01B285AA": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/SecurityGroup/Resource" + }, "Properties": { - "RouteTableId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1RouteTable4F1D2E36" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet1NATGateway5E3732C1" + "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/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet1/DefaultRoute" - } + "Type": "AWS::EC2::SecurityGroup" }, - "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73": { - "Type": "AWS::EC2::Subnet", + "MyWebServerLBSecurityGrouptoCdkECSStackTestEuropeMyWebServerServiceSecurityGroup792A2ECD807CF0A9FB": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/LB/SecurityGroup/to CdkECSStackTestEuropeMyWebServerServiceSecurityGroup792A2ECD:80" + }, "Properties": { - "VpcId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + "Description": "Load balancer to target", + "DestinationSecurityGroupId": { + "Fn::GetAtt": [ + "MyWebServerServiceSecurityGroup6788214A", + "GroupId" + ] }, - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } + "FromPort": 80, + "GroupId": { + "Fn::GetAtt": [ + "MyWebServerLBSecurityGroup01B285AA", + "GroupId" ] }, - "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" - } - ] + "IpProtocol": "tcp", + "ToPort": 80 }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/Subnet" - } + "Type": "AWS::EC2::SecurityGroupEgress" }, - "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591": { - "Type": "AWS::EC2::RouteTable", + "MyWebServerService2FE7341D": { + "DependsOn": [ + "MyWebServerLBPublicListenerECSGroup5AB9F1C3", + "MyWebServerLBPublicListener03D7C493", + "MyWebServerTaskDefTaskRoleB23C17AA" + ], + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/Service/Service" + }, "Properties": { - "VpcId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpc7788A521" + "Cluster": { + "Ref": "EcsDefaultClusterMnL3mNNYN926A5246" }, - "Tags": [ + "DeploymentConfiguration": { + "MaximumPercent": 200, + "MinimumHealthyPercent": 50 + }, + "EnableECSManagedTags": false, + "HealthCheckGracePeriodSeconds": 60, + "LaunchType": "FARGATE", + "LoadBalancers": [ { - "Key": "Name", - "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2" + "ContainerName": "web", + "ContainerPort": 80, + "TargetGroupArn": { + "Ref": "MyWebServerLBPublicListenerECSGroup5AB9F1C3" + } + } + ], + "NetworkConfiguration": { + "AwsvpcConfiguration": { + "AssignPublicIp": "DISABLED", + "SecurityGroups": [ + { + "Fn::GetAtt": [ + "MyWebServerServiceSecurityGroup6788214A", + "GroupId" + ] + } + ], + "Subnets": [ + { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet1Subnet075EFF4C" + }, + { + "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73" + } + ] } - ] - }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/RouteTable" - } - }, - "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableAssociation111C622F": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591" }, - "SubnetId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2SubnetE4CEDF73" + "TaskDefinition": { + "Ref": "MyWebServerTaskDef4CE825A0" } }, - "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/RouteTableAssociation" - } + "Type": "AWS::ECS::Service" }, - "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2DefaultRoute20CE2D89": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPrivateSubnet2RouteTableDCE46591" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "EcsDefaultClusterMnL3mNNYNVpcPublicSubnet2NATGateway4C855E00" - } - }, + "MyWebServerServiceSecurityGroup6788214A": { + "DependsOn": [ + "MyWebServerTaskDefTaskRoleB23C17AA" + ], "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc/PrivateSubnet2/DefaultRoute" - } - }, - "EcsDefaultClusterMnL3mNNYNVpcIGW9C2C2B8F": { - "Type": "AWS::EC2::InternetGateway", + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/Service/SecurityGroup/Resource" + }, "Properties": { - "Tags": [ + "GroupDescription": "CdkECSStackTest-Europe/MyWebServer/Service/SecurityGroup", + "SecurityGroupEgress": [ { - "Key": "Name", - "Value": "CdkECSStackTest-Europe/EcsDefaultClusterMnL3mNNYN/Vpc" + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" } - ] - }, - "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" - } + "Type": "AWS::EC2::SecurityGroup" }, - "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==" - }, + "MyWebServerServiceSecurityGroupfromCdkECSStackTestEuropeMyWebServerLBSecurityGroup8823910380E44CF71E": { + "DependsOn": [ + "MyWebServerTaskDefTaskRoleB23C17AA" + ], "Metadata": { - "aws:cdk:path": "CdkECSStackTest-Europe/CDKMetadata/Default" - } - }, - "slicWatchECSMemoryAlarmMyWebServerService2FE7341D": { - "Type": "AWS::CloudWatch::Alarm", + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/Service/SecurityGroup/from CdkECSStackTestEuropeMyWebServerLBSecurityGroup88239103:80" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "ECS_MemoryAlarm_\${MyWebServerService2FE7341D.Name}", - {} + "Description": "Load balancer to target", + "FromPort": 80, + "GroupId": { + "Fn::GetAtt": [ + "MyWebServerServiceSecurityGroup6788214A", + "GroupId" ] }, - "AlarmDescription": { - "Fn::Sub": [ - "ECS MemoryUtilization for \${MyWebServerService2FE7341D.Name} breaches 90", - {} + "IpProtocol": "tcp", + "SourceSecurityGroupId": { + "Fn::GetAtt": [ + "MyWebServerLBSecurityGroup01B285AA", + "GroupId" ] }, - "MetricName": "MemoryUtilization", - "Namespace": "AWS/ECS", - "Dimensions": [ - { - "Name": "ServiceName", - "Value": { - "Fn::GetAtt": [ - "MyWebServerService2FE7341D", - "Name" - ] - } - }, + "ToPort": 80 + }, + "Type": "AWS::EC2::SecurityGroupIngress" + }, + "MyWebServerTaskDef4CE825A0": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/Resource" + }, + "Properties": { + "ContainerDefinitions": [ { - "Name": "ClusterName", - "Value": { - "Ref": "EcsDefaultClusterMnL3mNNYN926A5246" - } + "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" + } + ] } ], - "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}", - {} + "Cpu": "256", + "ExecutionRoleArn": { + "Fn::GetAtt": [ + "MyWebServerTaskDefExecutionRole3C69E361", + "Arn" ] }, - "AlarmDescription": { - "Fn::Sub": [ - "ECS CPUUtilization for \${MyWebServerService2FE7341D.Name} breaches 90", - {} + "Family": "CdkECSStackTestEuropeMyWebServerTaskDef979012A1", + "Memory": "512", + "NetworkMode": "awsvpc", + "RequiresCompatibilities": [ + "FARGATE" + ], + "TaskRoleArn": { + "Fn::GetAtt": [ + "MyWebServerTaskDefTaskRoleB23C17AA", + "Arn" ] - }, - "MetricName": "CPUUtilization", - "Namespace": "AWS/ECS", - "Dimensions": [ - { - "Name": "ServiceName", - "Value": { - "Fn::GetAtt": [ - "MyWebServerService2FE7341D", - "Name" - ] - } - }, - { - "Name": "ClusterName", - "Value": { - "Ref": "EcsDefaultClusterMnL3mNNYN926A5246" + } + }, + "Type": "AWS::ECS::TaskDefinition" + }, + "MyWebServerTaskDefExecutionRole3C69E361": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/ExecutionRole/Resource" + }, + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + } } - } - ], - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Average", - "Threshold": 90 - } + ], + "Version": "2012-10-17" + } + }, + "Type": "AWS::IAM::Role" }, - "slicWatchLoadBalancerHTTPCodeELB5XXCountAlarmMyWebServerLB3B5FD3AB": { - "Type": "AWS::CloudWatch::Alarm", + "MyWebServerTaskDefExecutionRoleDefaultPolicy2AEB4329": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/ExecutionRole/DefaultPolicy/Resource" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [], - "OKActions": [], - "MetricName": "HTTPCode_ELB_5XX_Count", - "Namespace": "AWS/ApplicationELB", - "Dimensions": [ - { - "Name": "LoadBalancer", - "Value": { - "Fn::GetAtt": [ - "MyWebServerLB3B5FD3AB", - "LoadBalancerFullName" - ] + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "MyWebServerTaskDefwebLogGroupC6EE23D4", + "Arn" + ] + } } + ], + "Version": "2012-10-17" + }, + "PolicyName": "MyWebServerTaskDefExecutionRoleDefaultPolicy2AEB4329", + "Roles": [ + { + "Ref": "MyWebServerTaskDefExecutionRole3C69E361" } - ], - "AlarmName": "LoadBalancer_HTTPCodeELB5XXCountAlarm_MyWebServerLB3B5FD3AB", - "AlarmDescription": "LoadBalancer HTTPCodeELB5XXCount Sum for MyWebServerLB3B5FD3AB breaches 0", - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 0 - } + ] + }, + "Type": "AWS::IAM::Policy" }, - "slicWatchLoadBalancerRejectedConnectionCountAlarmMyWebServerLB3B5FD3AB": { - "Type": "AWS::CloudWatch::Alarm", + "MyWebServerTaskDefTaskRoleB23C17AA": { + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/TaskRole/Resource" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [], - "OKActions": [], - "MetricName": "RejectedConnectionCount", - "Namespace": "AWS/ApplicationELB", - "Dimensions": [ - { - "Name": "LoadBalancer", - "Value": { - "Fn::GetAtt": [ - "MyWebServerLB3B5FD3AB", - "LoadBalancerFullName" - ] + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + } } - } - ], - "AlarmName": "LoadBalancer_RejectedConnectionCountAlarm_MyWebServerLB3B5FD3AB", - "AlarmDescription": "LoadBalancer RejectedConnectionCount Sum for MyWebServerLB3B5FD3AB breaches 0", - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 0 - } + ], + "Version": "2012-10-17" + } + }, + "Type": "AWS::IAM::Role" }, - "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", + "MyWebServerTaskDefwebLogGroupC6EE23D4": { + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkECSStackTest-Europe/MyWebServer/TaskDef/web/LogGroup/Resource" + }, + "Type": "AWS::Logs::LogGroup", + "UpdateReplacePolicy": "Retain" + }, + "slicWatchDashboard": { "Properties": { "DashboardBody": { "Fn::Sub": { @@ -1208,343 +1015,400 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP ] } } - } - } - }, - "Outputs": { - "MyWebServerLoadBalancerDNSD1AFCC81": { - "Value": { - "Fn::GetAtt": [ - "MyWebServerLB3B5FD3AB", - "DNSName" - ] - } + }, + "Type": "AWS::CloudWatch::Dashboard" }, - "MyWebServerServiceURLB0ED50F6": { - "Value": { - "Fn::Join": [ - "", - [ - "http://", - { + "slicWatchECSCPUAlarmMyWebServerService2FE7341D": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "AlarmDescription": { + "Fn::Sub": [ + "ECS CPUUtilization for \${MyWebServerService2FE7341D.Name} breaches 90", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "ECS_CPUAlarm_\${MyWebServerService2FE7341D.Name}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "ServiceName", + "Value": { "Fn::GetAtt": [ - "MyWebServerLB3B5FD3AB", - "DNSName" + "MyWebServerService2FE7341D", + "Name" ] } - ] - ] - } - } - }, - "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 > the Macro adds SLIC Watch dashboards and alarms to synthesized CDK project > generalEuStack > 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" - } + "Name": "ClusterName", + "Value": { + "Ref": "EcsDefaultClusterMnL3mNNYN926A5246" } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] } - ] + ], + "EvaluationPeriods": 1, + "MetricName": "CPUUtilization", + "Namespace": "AWS/ECS", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 90, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/HelloHandler/ServiceRole/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "HelloHandler2E4FBA4D": { - "Type": "AWS::Lambda::Function", + "slicWatchECSMemoryAlarmMyWebServerService2FE7341D": { "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-eu-west-1" - }, - "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + "ActionsEnabled": true, + "AlarmActions": [], + "AlarmDescription": { + "Fn::Sub": [ + "ECS MemoryUtilization for \${MyWebServerService2FE7341D.Name} breaches 90", + {} + ] }, - "Role": { - "Fn::GetAtt": [ - "HelloHandlerServiceRole11EF7C63", - "Arn" + "AlarmName": { + "Fn::Sub": [ + "ECS_MemoryAlarm_\${MyWebServerService2FE7341D.Name}", + {} ] }, - "Handler": "hello.handler", - "Runtime": "nodejs18.x" - }, - "DependsOn": [ - "HelloHandlerServiceRole11EF7C63" - ], - "Metadata": { - "slicWatch": { - "alarms": { - "Lambda": { - "Invocations": { - "Threshold": 4 - } + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "ServiceName", + "Value": { + "Fn::GetAtt": [ + "MyWebServerService2FE7341D", + "Name" + ] + } + }, + { + "Name": "ClusterName", + "Value": { + "Ref": "EcsDefaultClusterMnL3mNNYN926A5246" } } - } - } + ], + "EvaluationPeriods": 1, + "MetricName": "MemoryUtilization", + "Namespace": "AWS/ECS", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 90, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "PingHandlerServiceRole46086423": { - "Type": "AWS::IAM::Role", + "slicWatchLoadBalancerHTTPCodeELB5XXCountAlarmMyWebServerLB3B5FD3AB": { "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ + "ActionsEnabled": true, + "AlarmActions": [], + "AlarmDescription": "LoadBalancer HTTPCodeELB5XXCount Sum for MyWebServerLB3B5FD3AB breaches 0", + "AlarmName": "LoadBalancer_HTTPCodeELB5XXCountAlarm_MyWebServerLB3B5FD3AB", + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "LoadBalancerFullName" ] - ] + } } - ] - }, - "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" + ], + "EvaluationPeriods": 1, + "MetricName": "HTTPCode_ELB_5XX_Count", + "Namespace": "AWS/ApplicationELB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "DependsOn": [ - "PingHandlerServiceRole46086423" - ], - "Metadata": { - "slicWatch": { - "dashboard": { - "enabled": false - } - } - } + "Type": "AWS::CloudWatch::Alarm" }, - "ThrottlerHandlerServiceRoleA0481DAF": { - "Type": "AWS::IAM::Role", + "slicWatchLoadBalancerHTTPCodeTarget5XXCountAlarmMyWebServerLBPublicListenerECSGroup5AB9F1C3": { "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } + "ActionsEnabled": true, + "AlarmActions": [], + "AlarmDescription": "LoadBalancer HTTPCode_Target_5XX_Count Sum for MyWebServerLBPublicListenerECSGroup5AB9F1C3 breaches 0", + "AlarmName": "LoadBalancer_HTTPCodeTarget5XXCountAlarm_MyWebServerLBPublicListenerECSGroup5AB9F1C3", + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TargetGroup", + "Value": { + "Fn::GetAtt": [ + "MyWebServerLBPublicListenerECSGroup5AB9F1C3", + "TargetGroupFullName" + ] } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ + }, { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "LoadBalancerFullName" ] - ] + } } - ] + ], + "EvaluationPeriods": 1, + "MetricName": "HTTPCode_Target_5XX_Count", + "Namespace": "AWS/ApplicationELB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/ThrottlerHandler/ServiceRole/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "ThrottlerHandler750A7C89": { - "Type": "AWS::Lambda::Function", + "slicWatchLoadBalancerRejectedConnectionCountAlarmMyWebServerLB3B5FD3AB": { "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" + "ActionsEnabled": true, + "AlarmActions": [], + "AlarmDescription": "LoadBalancer RejectedConnectionCount Sum for MyWebServerLB3B5FD3AB breaches 0", + "AlarmName": "LoadBalancer_RejectedConnectionCountAlarm_MyWebServerLB3B5FD3AB", + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "LoadBalancerFullName" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "RejectedConnectionCount", + "Namespace": "AWS/ApplicationELB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "DependsOn": [ - "ThrottlerHandlerServiceRoleA0481DAF" - ], - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/ThrottlerHandler/Resource", - "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", - "aws:asset:is-bundled": false, - "aws:asset:property": "Code" - } + "Type": "AWS::CloudWatch::Alarm" }, - "DriveStreamHandlerServiceRoleD2BAFDD4": { - "Type": "AWS::IAM::Role", + "slicWatchLoadBalancerUnHealthyHostCountAlarmMyWebServerLBPublicListenerECSGroup5AB9F1C3": { "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } + "ActionsEnabled": true, + "AlarmActions": [], + "AlarmDescription": "LoadBalancer UnHealthyHostCount Average for MyWebServerLBPublicListenerECSGroup5AB9F1C3 breaches 0", + "AlarmName": "LoadBalancer_UnHealthyHostCountAlarm_MyWebServerLBPublicListenerECSGroup5AB9F1C3", + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TargetGroup", + "Value": { + "Fn::GetAtt": [ + "MyWebServerLBPublicListenerECSGroup5AB9F1C3", + "TargetGroupFullName" + ] } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ + }, { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + "Name": "LoadBalancer", + "Value": { + "Fn::GetAtt": [ + "MyWebServerLB3B5FD3AB", + "LoadBalancerFullName" ] - ] + } } - ] + ], + "EvaluationPeriods": 1, + "MetricName": "UnHealthyHostCount", + "Namespace": "AWS/ApplicationELB", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveStreamHandler/ServiceRole/Resource" + "Type": "AWS::CloudWatch::Alarm" + } + }, + "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." + } + ] + } + }, + "Transform": "SlicWatch-v3" +} +` + +exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP > the Macro adds SLIC Watch dashboards and alarms to synthesized CDK project > generalEuStack > generalEuStack fragment 1`] = ` +{ + "Metadata": { + "slicWatch": { + "alarmActionsConfig": { + "alarmActions": [ + { + "Ref": "MyTopic86869434" + } + ] + }, + "alarms": { + "Lambda": { + "Invocations": { + "enabled": true, + "Threshold": 10 + } + }, + "SQS": { + "AgeOfOldestMessage": { + "enabled": true, + "Statistic": "Maximum", + "Threshold": 60 + }, + "InFlightMessagesPc": { + "Statistic": "Maximum", + "Threshold": 1 + } + } + }, + "enabled": true, + "topicArn": "arn:aws:xxxxxx:mytopic" + } + }, + "Outputs": { + "myapiEndpoint8EB17201": { + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "myapi162F20B8" + }, + ".execute-api.eu-west-1.", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/" + ] + ] } + } + }, + "Parameters": { + "BootstrapVersion": { + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]", + "Type": "AWS::SSM::Parameter::Value" + } + }, + "Resources": { + "CDKMetadata": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/CDKMetadata/Default" + }, + "Properties": { + "Analytics": "v2:deflate64:H4sIAAAAAAAA/02Q30/DIBDH/5a9M9SZmL12Gp801rr3hdKzshaoPdhsGv53D5izCeE+9z24Xxu+feC3K3HGtWy6da9qPn84ITtG0mFGg3ze20FJ9vhpEgTWC103gs/P3kinrImhJZcwaoVIXmBKaD5XtocYiDYwvD8IRHDIi2jI5zsvO3A7gcDEoFrh4CwmPr+kQhWgKwaVEvxjIaX1xrEnGHo7aSAkdeHRFG2qmoG+Wj9KSEXK0f5Mf8olceZXcF+2iVKmwJrJCG0b2ste1HmOBIHBierQfip/Gc+n8b5Jevfgk5Yh3aXtlZyuYnZDuHbG0jpit8q08dmbd4N3y/YCM7YBfsSb092W09msjqjUeqRNKA28yvYXs0P/r9UBAAA=" + }, + "Type": "AWS::CDK::Metadata" }, - "DriveStreamHandler62F1767B": { - "Type": "AWS::Lambda::Function", + "DeadLetterQueue9F481546": { + "DeletionPolicy": "Delete", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DeadLetterQueue/Resource" + }, + "Type": "AWS::SQS::Queue", + "UpdateReplacePolicy": "Delete" + }, + "DeadLetterQueuePolicyB1FB890C": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DeadLetterQueue/Policy/Resource" + }, + "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" + } + ] + }, + "Type": "AWS::SQS::QueuePolicy" + }, + "DriveQueueHandler9F657A00": { + "DependsOn": [ + "DriveQueueHandlerServiceRoleD796850A" + ], + "Metadata": { + "aws:asset:is-bundled": false, + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:property": "Code", + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveQueueHandler/Resource" + }, "Properties": { "Code": { "S3Bucket": { @@ -1552,27 +1416,21 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP }, "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" }, + "Handler": "hello.handler", "Role": { "Fn::GetAtt": [ - "DriveStreamHandlerServiceRoleD2BAFDD4", + "DriveQueueHandlerServiceRoleD796850A", "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" - } + "Type": "AWS::Lambda::Function" }, "DriveQueueHandlerServiceRoleD796850A": { - "Type": "AWS::IAM::Role", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveQueueHandler/ServiceRole/Resource" + }, "Properties": { "AssumeRolePolicyDocument": { "Statement": [ @@ -1601,12 +1459,18 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP } ] }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveQueueHandler/ServiceRole/Resource" - } + "Type": "AWS::IAM::Role" }, - "DriveQueueHandler9F657A00": { - "Type": "AWS::Lambda::Function", + "DriveStreamHandler62F1767B": { + "DependsOn": [ + "DriveStreamHandlerServiceRoleD2BAFDD4" + ], + "Metadata": { + "aws:asset:is-bundled": false, + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:property": "Code", + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveStreamHandler/Resource" + }, "Properties": { "Code": { "S3Bucket": { @@ -1614,27 +1478,21 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP }, "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" }, + "Handler": "stream-test-handler.handleDrive", "Role": { "Fn::GetAtt": [ - "DriveQueueHandlerServiceRoleD796850A", + "DriveStreamHandlerServiceRoleD2BAFDD4", "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" - } + "Type": "AWS::Lambda::Function" }, - "DriveTableHandlerServiceRoleDDA3FBE1": { - "Type": "AWS::IAM::Role", + "DriveStreamHandlerServiceRoleD2BAFDD4": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveStreamHandler/ServiceRole/Resource" + }, "Properties": { "AssumeRolePolicyDocument": { "Statement": [ @@ -1663,12 +1521,18 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP } ] }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveTableHandler/ServiceRole/Resource" - } + "Type": "AWS::IAM::Role" }, "DriveTableHandler119966B0": { - "Type": "AWS::Lambda::Function", + "DependsOn": [ + "DriveTableHandlerServiceRoleDDA3FBE1" + ], + "Metadata": { + "aws:asset:is-bundled": false, + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:property": "Code", + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveTableHandler/Resource" + }, "Properties": { "Code": { "S3Bucket": { @@ -1676,36 +1540,21 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP }, "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" }, + "Handler": "hello.handler", "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" - } + "Type": "AWS::Lambda::Function" }, - "myapi162F20B8": { - "Type": "AWS::ApiGateway::RestApi", - "Properties": { - "Name": "myapi" - }, + "DriveTableHandlerServiceRoleDDA3FBE1": { "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Resource" - } - }, - "myapiCloudWatchRoleEB425128": { - "Type": "AWS::IAM::Role", + "aws:cdk:path": "CdkGeneralStackTest-Europe/DriveTableHandler/ServiceRole/Resource" + }, "Properties": { "AssumeRolePolicyDocument": { "Statement": [ @@ -1713,7 +1562,7 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { - "Service": "apigateway.amazonaws.com" + "Service": "lambda.amazonaws.com" } } ], @@ -1728,92 +1577,155 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP { "Ref": "AWS::Partition" }, - ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } ] }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain", - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/CloudWatchRole/Resource" - } + "Type": "AWS::IAM::Role" }, - "myapiAccountC3A4750C": { - "Type": "AWS::ApiGateway::Account", - "Properties": { - "CloudWatchRoleArn": { - "Fn::GetAtt": [ - "myapiCloudWatchRoleEB425128", - "Arn" - ] - } - }, + "HelloHandler2E4FBA4D": { "DependsOn": [ - "myapi162F20B8" + "HelloHandlerServiceRole11EF7C63" ], - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain", "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Account" - } - }, - "myapiDeploymentB7EF8EB76dbd4bbbb18c5c458967fb55792b4830": { - "Type": "AWS::ApiGateway::Deployment", + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 4 + } + } + } + } + }, "Properties": { - "RestApiId": { - "Ref": "myapi162F20B8" + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Handler": "hello.handler", + "Role": { + "Fn::GetAtt": [ + "HelloHandlerServiceRole11EF7C63", + "Arn" + ] }, - "Description": "Automatically created by the RestApi construct" + "Runtime": "nodejs18.x" }, - "DependsOn": [ - "myapiproxyANYDD7FCE64", - "myapiproxyB6DF4575", - "myapiANY111D56B7" - ], - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Deployment/Resource" - } + "Type": "AWS::Lambda::Function" }, - "myapiDeploymentStageprod329F21FF": { - "Type": "AWS::ApiGateway::Stage", + "HelloHandlerServiceRole11EF7C63": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/HelloHandler/ServiceRole/Resource" + }, "Properties": { - "RestApiId": { - "Ref": "myapi162F20B8" - }, - "DeploymentId": { - "Ref": "myapiDeploymentB7EF8EB76dbd4bbbb18c5c458967fb55792b4830" + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" }, - "StageName": "prod" + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Type": "AWS::IAM::Role" + }, + "myapi162F20B8": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Resource" + }, + "Properties": { + "Name": "myapi" }, + "Type": "AWS::ApiGateway::RestApi" + }, + "myapiAccountC3A4750C": { + "DeletionPolicy": "Retain", "DependsOn": [ - "myapiAccountC3A4750C" + "myapi162F20B8" ], "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/DeploymentStage.prod/Resource" - } + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Account" + }, + "Properties": { + "CloudWatchRoleArn": { + "Fn::GetAtt": [ + "myapiCloudWatchRoleEB425128", + "Arn" + ] + } + }, + "Type": "AWS::ApiGateway::Account", + "UpdateReplacePolicy": "Retain" }, - "myapiproxyB6DF4575": { - "Type": "AWS::ApiGateway::Resource", + "myapiANY111D56B7": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/ANY/Resource" + }, "Properties": { - "ParentId": { + "AuthorizationType": "NONE", + "HttpMethod": "ANY", + "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" + ] + ] + } + }, + "ResourceId": { "Fn::GetAtt": [ "myapi162F20B8", "RootResourceId" ] }, - "PathPart": "{proxy+}", "RestApiId": { "Ref": "myapi162F20B8" } }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/Resource" - } + "Type": "AWS::ApiGateway::Method" }, - "myapiproxyANYApiPermissionCdkGeneralStackTestEuropemyapi65F2E57FANYproxyBDBDCB62": { - "Type": "AWS::Lambda::Permission", + "myapiANYApiPermissionCdkGeneralStackTestEuropemyapi65F2E57FANYEF4BF8F6": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/ANY/ApiPermission.CdkGeneralStackTestEuropemyapi65F2E57F.ANY.." + }, "Properties": { "Action": "lambda:InvokeFunction", "FunctionName": { @@ -1843,17 +1755,17 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP { "Ref": "myapiDeploymentStageprod329F21FF" }, - "/*/*" + "/*/" ] ] } }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/ANY/ApiPermission.CdkGeneralStackTestEuropemyapi65F2E57F.ANY..{proxy+}" - } + "Type": "AWS::Lambda::Permission" }, - "myapiproxyANYApiPermissionTestCdkGeneralStackTestEuropemyapi65F2E57FANYproxyF17A09F1": { - "Type": "AWS::Lambda::Permission", + "myapiANYApiPermissionTestCdkGeneralStackTestEuropemyapi65F2E57FANY3EBCCF8C": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/ANY/ApiPermission.Test.CdkGeneralStackTestEuropemyapi65F2E57F.ANY.." + }, "Properties": { "Action": "lambda:InvokeFunction", "FunctionName": { @@ -1879,30 +1791,33 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP { "Ref": "myapi162F20B8" }, - "/test-invoke-stage/*/*" + "/test-invoke-stage/*/" ] ] } }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/ANY/ApiPermission.Test.CdkGeneralStackTestEuropemyapi65F2E57F.ANY..{proxy+}" - } + "Type": "AWS::Lambda::Permission" }, - "myapiproxyANYDD7FCE64": { - "Type": "AWS::ApiGateway::Method", + "myapiCloudWatchRoleEB425128": { + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/CloudWatchRole/Resource" + }, "Properties": { - "HttpMethod": "ANY", - "ResourceId": { - "Ref": "myapiproxyB6DF4575" - }, - "RestApiId": { - "Ref": "myapi162F20B8" + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" }, - "AuthorizationType": "NONE", - "Integration": { - "IntegrationHttpMethod": "POST", - "Type": "AWS_PROXY", - "Uri": { + "ManagedPolicyArns": [ + { "Fn::Join": [ "", [ @@ -1910,25 +1825,54 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP { "Ref": "AWS::Partition" }, - ":apigateway:eu-west-1:lambda:path/2015-03-31/functions/", - { - "Fn::GetAtt": [ - "HelloHandler2E4FBA4D", - "Arn" - ] - }, - "/invocations" + ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" ] ] } + ] + }, + "Type": "AWS::IAM::Role", + "UpdateReplacePolicy": "Retain" + }, + "myapiDeploymentB7EF8EB76dbd4bbbb18c5c458967fb55792b4830": { + "DependsOn": [ + "myapiproxyANYDD7FCE64", + "myapiproxyB6DF4575", + "myapiANY111D56B7" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Deployment/Resource" + }, + "Properties": { + "Description": "Automatically created by the RestApi construct", + "RestApiId": { + "Ref": "myapi162F20B8" } }, + "Type": "AWS::ApiGateway::Deployment" + }, + "myapiDeploymentStageprod329F21FF": { + "DependsOn": [ + "myapiAccountC3A4750C" + ], "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/ANY/Resource" - } + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/DeploymentStage.prod/Resource" + }, + "Properties": { + "DeploymentId": { + "Ref": "myapiDeploymentB7EF8EB76dbd4bbbb18c5c458967fb55792b4830" + }, + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "StageName": "prod" + }, + "Type": "AWS::ApiGateway::Stage" }, - "myapiANYApiPermissionCdkGeneralStackTestEuropemyapi65F2E57FANYEF4BF8F6": { - "Type": "AWS::Lambda::Permission", + "myapiproxyANYApiPermissionCdkGeneralStackTestEuropemyapi65F2E57FANYproxyBDBDCB62": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/ANY/ApiPermission.CdkGeneralStackTestEuropemyapi65F2E57F.ANY..{proxy+}" + }, "Properties": { "Action": "lambda:InvokeFunction", "FunctionName": { @@ -1958,17 +1902,17 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP { "Ref": "myapiDeploymentStageprod329F21FF" }, - "/*/" + "/*/*" ] ] } }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/ANY/ApiPermission.CdkGeneralStackTestEuropemyapi65F2E57F.ANY.." - } + "Type": "AWS::Lambda::Permission" }, - "myapiANYApiPermissionTestCdkGeneralStackTestEuropemyapi65F2E57FANY3EBCCF8C": { - "Type": "AWS::Lambda::Permission", + "myapiproxyANYApiPermissionTestCdkGeneralStackTestEuropemyapi65F2E57FANYproxyF17A09F1": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/ANY/ApiPermission.Test.CdkGeneralStackTestEuropemyapi65F2E57F.ANY..{proxy+}" + }, "Properties": { "Action": "lambda:InvokeFunction", "FunctionName": { @@ -1994,29 +1938,20 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP { "Ref": "myapi162F20B8" }, - "/test-invoke-stage/*/" + "/test-invoke-stage/*/*" ] ] } }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/ANY/ApiPermission.Test.CdkGeneralStackTestEuropemyapi65F2E57F.ANY.." - } + "Type": "AWS::Lambda::Permission" }, - "myapiANY111D56B7": { - "Type": "AWS::ApiGateway::Method", + "myapiproxyANYDD7FCE64": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/ANY/Resource" + }, "Properties": { - "HttpMethod": "ANY", - "ResourceId": { - "Fn::GetAtt": [ - "myapi162F20B8", - "RootResourceId" - ] - }, - "RestApiId": { - "Ref": "myapi162F20B8" - }, "AuthorizationType": "NONE", + "HttpMethod": "ANY", "Integration": { "IntegrationHttpMethod": "POST", "Type": "AWS_PROXY", @@ -2039,74 +1974,107 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP ] ] } + }, + "ResourceId": { + "Ref": "myapiproxyB6DF4575" + }, + "RestApiId": { + "Ref": "myapi162F20B8" } }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/ANY/Resource" - } + "Type": "AWS::ApiGateway::Method" }, - "TableCD117FA1": { - "Type": "AWS::DynamoDB::Table", + "myapiproxyB6DF4575": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/myapi/Default/{proxy+}/Resource" + }, "Properties": { - "KeySchema": [ - { - "AttributeName": "id", - "KeyType": "HASH" - } - ], - "AttributeDefinitions": [ - { - "AttributeName": "id", - "AttributeType": "S" - } - ], - "BillingMode": "PAY_PER_REQUEST" + "ParentId": { + "Fn::GetAtt": [ + "myapi162F20B8", + "RootResourceId" + ] + }, + "PathPart": "{proxy+}", + "RestApiId": { + "Ref": "myapi162F20B8" + } }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain", + "Type": "AWS::ApiGateway::Resource" + }, + "MyTopic86869434": { "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/Table/Resource" - } + "aws:cdk:path": "CdkGeneralStackTest-Europe/MyTopic/Resource" + }, + "Type": "AWS::SNS::Topic" }, - "ruleF2C1DCDC": { - "Type": "AWS::Events::Rule", + "PingHandler50068074": { + "DependsOn": [ + "PingHandlerServiceRole46086423" + ], + "Metadata": { + "slicWatch": { + "dashboard": { + "enabled": false + } + } + }, "Properties": { - "EventPattern": { - "source": [ - "aws.ec2" + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Handler": "hello.handler", + "Role": { + "Fn::GetAtt": [ + "PingHandlerServiceRole46086423", + "Arn" ] }, - "State": "ENABLED", - "Targets": [ - { - "Arn": { - "Fn::GetAtt": [ - "HelloHandler2E4FBA4D", - "Arn" - ] - }, - "DeadLetterConfig": { - "Arn": { - "Fn::GetAtt": [ - "DeadLetterQueue9F481546", - "Arn" - ] + "Runtime": "nodejs18.x" + }, + "Type": "AWS::Lambda::Function" + }, + "PingHandlerServiceRole46086423": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/PingHandler/ServiceRole/Resource" + }, + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" } - }, - "Id": "Target0", - "RetryPolicy": { - "MaximumEventAgeInSeconds": 7200, - "MaximumRetryAttempts": 2 } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] } ] }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/rule/Resource" - } + "Type": "AWS::IAM::Role" }, "ruleAllowEventRuleCdkGeneralStackTestEuropeHelloHandlerE25EBD9DD0F76E59": { - "Type": "AWS::Lambda::Permission", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/rule/AllowEventRuleCdkGeneralStackTestEuropeHelloHandlerE25EBD9D" + }, "Properties": { "Action": "lambda:InvokeFunction", "FunctionName": { @@ -2123,71 +2091,46 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP ] } }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/rule/AllowEventRuleCdkGeneralStackTestEuropeHelloHandlerE25EBD9D" - } + "Type": "AWS::Lambda::Permission" }, - "DeadLetterQueue9F481546": { - "Type": "AWS::SQS::Queue", - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete", + "ruleF2C1DCDC": { "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-Europe/DeadLetterQueue/Resource" - } - }, - "DeadLetterQueuePolicyB1FB890C": { - "Type": "AWS::SQS::QueuePolicy", + "aws:cdk:path": "CdkGeneralStackTest-Europe/rule/Resource" + }, "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "sqs:SendMessage", - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Fn::GetAtt": [ - "ruleF2C1DCDC", - "Arn" - ] - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Resource": { + "EventPattern": { + "source": [ + "aws.ec2" + ] + }, + "State": "ENABLED", + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "DeadLetterConfig": { + "Arn": { "Fn::GetAtt": [ "DeadLetterQueue9F481546", "Arn" ] - }, - "Sid": "AllowEventRuleCdkGeneralStackTestEuroperule6219EF60" + } + }, + "Id": "Target0", + "RetryPolicy": { + "MaximumEventAgeInSeconds": 7200, + "MaximumRetryAttempts": 2 } - ], - "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" - } + "Type": "AWS::Events::Rule" }, - "slicWatchLambdaErrorsAlarmHelloHandler2E4FBA4D": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchApi4XXErrorAlarmmyapi": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -2195,39 +2138,37 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Errors_\${HelloHandler2E4FBA4D}", + "API Gateway 4XXError Average for myapi breaches 0.05", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Error count for \${HelloHandler2E4FBA4D} breaches 0", + "ApiGW_4XXError_myapi", {} ] }, - "MetricName": "Errors", - "Namespace": "AWS/Lambda", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "FunctionName", - "Value": { - "Ref": "HelloHandler2E4FBA4D" - } + "Name": "ApiName", + "Value": "myapi" } ], - "Statistic": "Sum", - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + "MetricName": "4XXError", + "Namespace": "AWS/ApiGateway", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 0.05, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaThrottlesAlarmHelloHandler2E4FBA4D": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchApi5XXErrorAlarmmyapi": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -2235,155 +2176,37 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Throttles_\${HelloHandler2E4FBA4D}", + "API Gateway 5XXError Average for myapi breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Throttles % for \${HelloHandler2E4FBA4D} breaches 0", + "ApiGW_5XXError_myapi", {} ] }, - "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" - } + "Name": "ApiName", + "Value": "myapi" } ], - "Statistic": "Maximum", - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 2850 - } - }, - "slicWatchLambdaInvocationsAlarmHelloHandler2E4FBA4D": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" - } - ], + "MetricName": "5XXError", + "Namespace": "AWS/ApiGateway", "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 - } + "Statistic": "Average", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaErrorsAlarmPingHandler50068074": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchApiLatencyAlarmmyapi": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -2391,1854 +2214,386 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "Lambda_Errors_\${PingHandler50068074}", - {} - ] - }, "AlarmDescription": { "Fn::Sub": [ - "Error count for \${PingHandler50068074} breaches 0", + "API Gateway Latency p99 for myapi breaches 5000", {} ] }, - "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", + "ApiGW_Latency_myapi", {} ] }, - "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" - } + "Name": "ApiName", + "Value": "myapi" } ], - "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" - } - ], + "ExtendedStatistic": "p99", + "MetricName": "Latency", + "Namespace": "AWS/ApiGateway", "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 - } + "Threshold": 5000, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaThrottlesAlarmThrottlerHandler750A7C89": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchDashboard": { "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" - } - } - ] + "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 }, - "Period": 60, - "Stat": "Sum" - }, - "ReturnData": false - }, - { - "Id": "invocations", - "MetricStat": { - "Metric": { - "Namespace": "AWS/Lambda", - "MetricName": "Invocations", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "ThrottlerHandler750A7C89" - } - } - ] + { + "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 }, - "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" - } - } - ] + { + "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 }, - "Period": 60, - "Stat": "Sum" - }, - "ReturnData": false - }, - { - "Id": "invocations", - "MetricStat": { - "Metric": { - "Namespace": "AWS/Lambda", - "MetricName": "Invocations", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "DriveStreamHandler62F1767B" - } - } - ] + { + "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 }, - "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" - } - } - ] + { + "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 }, - "Period": 60, - "Stat": "Sum" - }, - "ReturnData": false - }, - { - "Id": "invocations", - "MetricStat": { - "Metric": { - "Namespace": "AWS/Lambda", - "MetricName": "Invocations", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "DriveQueueHandler9F657A00" - } - } - ] + { + "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 }, - "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" - } - } - ] + { + "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 }, - "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", + "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", @@ -4704,988 +3059,966 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "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 > the Macro adds SLIC Watch dashboards and alarms to synthesized CDK project > generalUsStack > 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" - } + "Type": "AWS::CloudWatch::Dashboard" }, - "HelloHandlerServiceRole11EF7C63": { - "Type": "AWS::IAM::Role", + "slicWatchEventsFailedInvocationsAlarmRuleF2C1DCDC": { "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ + "ActionsEnabled": true, + "AlarmActions": [ { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] + "Ref": "MyTopic86869434" } - ] - }, - "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" + ], + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge FailedInvocations for \${ruleF2C1DCDC} breaches 1", + {} + ] }, - "Role": { - "Fn::GetAtt": [ - "HelloHandlerServiceRole11EF7C63", - "Arn" + "AlarmName": { + "Fn::Sub": [ + "Events_FailedInvocations_Alarm_\${ruleF2C1DCDC}", + {} ] }, - "Handler": "hello.handler", - "Runtime": "nodejs18.x" - }, - "DependsOn": [ - "HelloHandlerServiceRole11EF7C63" - ], - "Metadata": { - "slicWatch": { - "alarms": { - "Lambda": { - "Invocations": { - "Threshold": 4 - } + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "ruleF2C1DCDC" } } - } - } + ], + "EvaluationPeriods": 1, + "MetricName": "FailedInvocations", + "Namespace": "AWS/Events", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "PingHandlerServiceRole46086423": { - "Type": "AWS::IAM::Role", + "slicWatchEventsThrottledRulesAlarmRuleF2C1DCDC": { "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ + "ActionsEnabled": true, + "AlarmActions": [ { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] + "Ref": "MyTopic86869434" } - ] - }, - "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" + ], + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge ThrottledRules for \${ruleF2C1DCDC} breaches 1", + {} ] }, - "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" + "AlarmName": { + "Fn::Sub": [ + "Events_ThrottledRules_Alarm_\${ruleF2C1DCDC}", + {} + ] }, - "ManagedPolicyArns": [ + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] + "Name": "RuleName", + "Value": { + "Ref": "ruleF2C1DCDC" + } } - ] + ], + "EvaluationPeriods": 1, + "MetricName": "ThrottledRules", + "Namespace": "AWS/Events", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/ThrottlerHandler/ServiceRole/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "ThrottlerHandler750A7C89": { - "Type": "AWS::Lambda::Function", + "slicWatchLambdaDurationAlarmDriveQueueHandler9F657A00": { "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" - }, - "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${DriveQueueHandler9F657A00} breaches 95% of timeout (3)", + {} + ] }, - "Role": { - "Fn::GetAtt": [ - "ThrottlerHandlerServiceRoleA0481DAF", - "Arn" + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${DriveQueueHandler9F657A00}", + {} ] }, - "Handler": "hello.handler", - "ReservedConcurrentExecutions": 0, - "Runtime": "nodejs18.x" + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" }, - "DependsOn": [ - "ThrottlerHandlerServiceRoleA0481DAF" - ], - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/ThrottlerHandler/Resource", - "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", - "aws:asset:is-bundled": false, - "aws:asset:property": "Code" - } + "Type": "AWS::CloudWatch::Alarm" }, - "DriveStreamHandlerServiceRoleD2BAFDD4": { - "Type": "AWS::IAM::Role", + "slicWatchLambdaDurationAlarmDriveStreamHandler62F1767B": { "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${DriveStreamHandler62F1767B} breaches 95% of timeout (3)", + {} + ] }, - "ManagedPolicyArns": [ + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } } - ] + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/DriveStreamHandler/ServiceRole/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "DriveStreamHandler62F1767B": { - "Type": "AWS::Lambda::Function", + "slicWatchLambdaDurationAlarmDriveTableHandler119966B0": { "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" - }, - "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${DriveTableHandler119966B0} breaches 95% of timeout (3)", + {} + ] }, - "Role": { - "Fn::GetAtt": [ - "DriveStreamHandlerServiceRoleD2BAFDD4", - "Arn" + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${DriveTableHandler119966B0}", + {} ] }, - "Handler": "stream-test-handler.handleDrive", - "Runtime": "nodejs18.x" + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" }, - "DependsOn": [ - "DriveStreamHandlerServiceRoleD2BAFDD4" - ], - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/DriveStreamHandler/Resource", - "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", - "aws:asset:is-bundled": false, - "aws:asset:property": "Code" - } + "Type": "AWS::CloudWatch::Alarm" }, - "DriveQueueHandlerServiceRoleD796850A": { - "Type": "AWS::IAM::Role", + "slicWatchLambdaDurationAlarmHelloHandler2E4FBA4D": { "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${HelloHandler2E4FBA4D} breaches 95% of timeout (3)", + {} + ] }, - "ManagedPolicyArns": [ + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } } - ] + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/DriveQueueHandler/ServiceRole/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "DriveQueueHandler9F657A00": { - "Type": "AWS::Lambda::Function", + "slicWatchLambdaDurationAlarmPingHandler50068074": { "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" - }, - "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${PingHandler50068074} breaches 95% of timeout (3)", + {} + ] }, - "Role": { - "Fn::GetAtt": [ - "DriveQueueHandlerServiceRoleD796850A", - "Arn" + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${PingHandler50068074}", + {} ] }, - "Handler": "hello.handler", - "Runtime": "nodejs18.x" + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" }, - "DependsOn": [ - "DriveQueueHandlerServiceRoleD796850A" - ], - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/DriveQueueHandler/Resource", - "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", - "aws:asset:is-bundled": false, - "aws:asset:property": "Code" - } + "Type": "AWS::CloudWatch::Alarm" }, - "DriveTableHandlerServiceRoleDDA3FBE1": { - "Type": "AWS::IAM::Role", + "slicWatchLambdaDurationAlarmThrottlerHandler750A7C89": { "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${ThrottlerHandler750A7C89} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${ThrottlerHandler750A7C89}", + {} + ] }, - "ManagedPolicyArns": [ + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } } - ] + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/DriveTableHandler/ServiceRole/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "DriveTableHandler119966B0": { - "Type": "AWS::Lambda::Function", + "slicWatchLambdaErrorsAlarmDriveQueueHandler9F657A00": { "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" - }, - "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${DriveQueueHandler9F657A00} breaches 0", + {} + ] }, - "Role": { - "Fn::GetAtt": [ - "DriveTableHandlerServiceRoleDDA3FBE1", - "Arn" + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${DriveQueueHandler9F657A00}", + {} ] }, - "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" + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "myapiCloudWatchRoleEB425128": { - "Type": "AWS::IAM::Role", + "slicWatchLambdaErrorsAlarmDriveStreamHandler62F1767B": { "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "apigateway.amazonaws.com" - } - } - ], - "Version": "2012-10-17" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${DriveStreamHandler62F1767B} breaches 0", + {} + ] }, - "ManagedPolicyArns": [ + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" - ] - ] + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } } - ] + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain", - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/myapi/CloudWatchRole/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "myapiAccountC3A4750C": { - "Type": "AWS::ApiGateway::Account", + "slicWatchLambdaErrorsAlarmDriveTableHandler119966B0": { "Properties": { - "CloudWatchRoleArn": { - "Fn::GetAtt": [ - "myapiCloudWatchRoleEB425128", - "Arn" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${DriveTableHandler119966B0} breaches 0", + {} ] - } + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${DriveTableHandler119966B0}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "DependsOn": [ - "myapi162F20B8" - ], - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain", - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Account" - } + "Type": "AWS::CloudWatch::Alarm" }, - "myapiDeploymentB7EF8EB7fea2aa51ab5416f81a0b318c3a85d817": { - "Type": "AWS::ApiGateway::Deployment", + "slicWatchLambdaErrorsAlarmHelloHandler2E4FBA4D": { "Properties": { - "RestApiId": { - "Ref": "myapi162F20B8" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${HelloHandler2E4FBA4D} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${HelloHandler2E4FBA4D}", + {} + ] }, - "Description": "Automatically created by the RestApi construct" + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "DependsOn": [ - "myapiproxyANYDD7FCE64", - "myapiproxyB6DF4575", - "myapiANY111D56B7" - ], - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Deployment/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "myapiDeploymentStageprod329F21FF": { - "Type": "AWS::ApiGateway::Stage", + "slicWatchLambdaErrorsAlarmPingHandler50068074": { "Properties": { - "RestApiId": { - "Ref": "myapi162F20B8" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${PingHandler50068074} breaches 0", + {} + ] }, - "DeploymentId": { - "Ref": "myapiDeploymentB7EF8EB7fea2aa51ab5416f81a0b318c3a85d817" + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${PingHandler50068074}", + {} + ] }, - "StageName": "prod" + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "DependsOn": [ - "myapiAccountC3A4750C" - ], - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/myapi/DeploymentStage.prod/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "myapiproxyB6DF4575": { - "Type": "AWS::ApiGateway::Resource", + "slicWatchLambdaErrorsAlarmThrottlerHandler750A7C89": { "Properties": { - "ParentId": { - "Fn::GetAtt": [ - "myapi162F20B8", - "RootResourceId" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${ThrottlerHandler750A7C89} breaches 0", + {} ] }, - "PathPart": "{proxy+}", - "RestApiId": { - "Ref": "myapi162F20B8" - } + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "myapiproxyANYApiPermissionCdkGeneralStackTestUSmyapi9E6CC024ANYproxy61FC0812": { - "Type": "AWS::Lambda::Permission", + "slicWatchLambdaInvocationsAlarmDriveQueueHandler9F657A00": { "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "HelloHandler2E4FBA4D", - "Arn" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${DriveQueueHandler9F657A00} breaches 10", + {} ] }, - "Principal": "apigateway.amazonaws.com", - "SourceArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":execute-api:us-east-1:", - { - "Ref": "AWS::AccountId" - }, - ":", - { - "Ref": "myapi162F20B8" - }, - "/", - { - "Ref": "myapiDeploymentStageprod329F21FF" - }, - "/*/*" - ] + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${DriveQueueHandler9F657A00}", + {} ] - } + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/ANY/ApiPermission.CdkGeneralStackTestUSmyapi9E6CC024.ANY..{proxy+}" - } + "Type": "AWS::CloudWatch::Alarm" }, - "myapiproxyANYApiPermissionTestCdkGeneralStackTestUSmyapi9E6CC024ANYproxy352B4E19": { - "Type": "AWS::Lambda::Permission", + "slicWatchLambdaInvocationsAlarmDriveStreamHandler62F1767B": { "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "HelloHandler2E4FBA4D", - "Arn" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${DriveStreamHandler62F1767B} breaches 10", + {} ] }, - "Principal": "apigateway.amazonaws.com", - "SourceArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":execute-api:us-east-1:", - { - "Ref": "AWS::AccountId" - }, - ":", - { - "Ref": "myapi162F20B8" - }, - "/test-invoke-stage/*/*" - ] + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${DriveStreamHandler62F1767B}", + {} ] - } + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/ANY/ApiPermission.Test.CdkGeneralStackTestUSmyapi9E6CC024.ANY..{proxy+}" - } + "Type": "AWS::CloudWatch::Alarm" }, - "myapiproxyANYDD7FCE64": { - "Type": "AWS::ApiGateway::Method", + "slicWatchLambdaInvocationsAlarmDriveTableHandler119966B0": { "Properties": { - "HttpMethod": "ANY", - "ResourceId": { - "Ref": "myapiproxyB6DF4575" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${DriveTableHandler119966B0} breaches 10", + {} + ] }, - "RestApiId": { - "Ref": "myapi162F20B8" + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${DriveTableHandler119966B0}", + {} + ] }, - "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" - ] - ] + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmHelloHandler2E4FBA4D": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" } - } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${HelloHandler2E4FBA4D} breaches 4", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 4, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/ANY/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "myapiANYApiPermissionCdkGeneralStackTestUSmyapi9E6CC024ANY52E5EFEE": { - "Type": "AWS::Lambda::Permission", + "slicWatchLambdaInvocationsAlarmPingHandler50068074": { "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "HelloHandler2E4FBA4D", - "Arn" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${PingHandler50068074} breaches 10", + {} ] }, - "Principal": "apigateway.amazonaws.com", - "SourceArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":execute-api:us-east-1:", - { - "Ref": "AWS::AccountId" - }, - ":", - { - "Ref": "myapi162F20B8" - }, - "/", - { - "Ref": "myapiDeploymentStageprod329F21FF" - }, - "/*/" - ] + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${PingHandler50068074}", + {} ] - } + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/ANY/ApiPermission.CdkGeneralStackTestUSmyapi9E6CC024.ANY.." - } + "Type": "AWS::CloudWatch::Alarm" }, - "myapiANYApiPermissionTestCdkGeneralStackTestUSmyapi9E6CC024ANY1136CBF8": { - "Type": "AWS::Lambda::Permission", + "slicWatchLambdaInvocationsAlarmThrottlerHandler750A7C89": { "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "HelloHandler2E4FBA4D", - "Arn" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${ThrottlerHandler750A7C89} breaches 10", + {} ] }, - "Principal": "apigateway.amazonaws.com", - "SourceArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":execute-api:us-east-1:", - { - "Ref": "AWS::AccountId" - }, - ":", - { - "Ref": "myapi162F20B8" - }, - "/test-invoke-stage/*/" - ] + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${ThrottlerHandler750A7C89}", + {} ] - } + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/ANY/ApiPermission.Test.CdkGeneralStackTestUSmyapi9E6CC024.ANY.." - } + "Type": "AWS::CloudWatch::Alarm" }, - "myapiANY111D56B7": { - "Type": "AWS::ApiGateway::Method", + "slicWatchLambdaThrottlesAlarmDriveQueueHandler9F657A00": { "Properties": { - "HttpMethod": "ANY", - "ResourceId": { - "Fn::GetAtt": [ - "myapi162F20B8", - "RootResourceId" + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${DriveQueueHandler9F657A00} breaches 0", + {} ] }, - "RestApiId": { - "Ref": "myapi162F20B8" + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${DriveQueueHandler9F657A00}", + {} + ] }, - "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" - ] - ] + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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 } - } + ], + "OKActions": [], + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/ANY/Resource" - } + "Type": "AWS::CloudWatch::Alarm" }, - "TableCD117FA1": { - "Type": "AWS::DynamoDB::Table", + "slicWatchLambdaThrottlesAlarmDriveStreamHandler62F1767B": { "Properties": { - "KeySchema": [ - { - "AttributeName": "id", - "KeyType": "HASH" - } - ], - "AttributeDefinitions": [ + "ActionsEnabled": true, + "AlarmActions": [ { - "AttributeName": "id", - "AttributeType": "S" + "Ref": "MyTopic86869434" } ], - "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" + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${DriveStreamHandler62F1767B} breaches 0", + {} ] }, - "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" + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${DriveStreamHandler62F1767B}", + {} ] }, - "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" - ] + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "DeadLetterQueue9F481546", - "Arn" ] }, - "Sid": "AllowEventRuleCdkGeneralStackTestUSruleB0D09E87" - } - ], - "Version": "2012-10-17" - }, - "Queues": [ + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, { - "Ref": "DeadLetterQueue9F481546" + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ] + }, + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false } - ] - }, - "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=" + ], + "OKActions": [], + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkGeneralStackTest-US/CDKMetadata/Default" - } + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaErrorsAlarmHelloHandler2E4FBA4D": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchLambdaThrottlesAlarmDriveTableHandler119966B0": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -5693,39 +4026,75 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Errors_\${HelloHandler2E4FBA4D}", + "Throttles % for \${DriveTableHandler119966B0} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Error count for \${HelloHandler2E4FBA4D} breaches 0", + "Lambda_Throttles_\${DriveTableHandler119966B0}", {} ] }, - "MetricName": "Errors", - "Namespace": "AWS/Lambda", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "HelloHandler2E4FBA4D" - } - } - ], - "Statistic": "Sum", - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + "EvaluationPeriods": 1, + "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 + } + ], + "OKActions": [], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, "slicWatchLambdaThrottlesAlarmHelloHandler2E4FBA4D": { - "Type": "AWS::CloudWatch::Alarm", "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -5733,19 +4102,20 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Throttles_\${HelloHandler2E4FBA4D}", + "Throttles % for \${HelloHandler2E4FBA4D} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Throttles % for \${HelloHandler2E4FBA4D} breaches 0", + "Lambda_Throttles_\${HelloHandler2E4FBA4D}", {} ] }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, "Metrics": [ { "Id": "throttles_pc", @@ -5794,94 +4164,13 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "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 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaErrorsAlarmPingHandler50068074": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchLambdaThrottlesAlarmPingHandler50068074": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -5889,59 +4178,20 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "Lambda_Errors_\${PingHandler50068074}", - {} - ] - }, "AlarmDescription": { "Fn::Sub": [ - "Error count for \${PingHandler50068074} breaches 0", + "Throttles % 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", - {} - ] - }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, "Metrics": [ { "Id": "throttles_pc", @@ -5990,94 +4240,13 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "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 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaErrorsAlarmThrottlerHandler750A7C89": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchLambdaThrottlesAlarmThrottlerHandler750A7C89": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -6085,59 +4254,20 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "Lambda_Errors_\${ThrottlerHandler750A7C89}", - {} - ] - }, "AlarmDescription": { "Fn::Sub": [ - "Error count for \${ThrottlerHandler750A7C89} breaches 0", + "Throttles % 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", + "Lambda_Throttles_\${ThrottlerHandler750A7C89}", {} ] }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, "Metrics": [ { "Id": "throttles_pc", @@ -6186,14 +4316,13 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "ReturnData": false } ], - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + "OKActions": [], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaDurationAlarmThrottlerHandler750A7C89": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchSNSNumberOfNotificationsFailedAlarmMyTopic86869434": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -6201,39 +4330,42 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Duration_\${ThrottlerHandler750A7C89}", + "SNS NumberOfNotificationsFailed for \${MyTopic86869434.TopicName} breaches 1", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Max duration for \${ThrottlerHandler750A7C89} breaches 95% of timeout (3)", + "SNS_NumberOfNotificationsFailed_Alarm_\${MyTopic86869434.TopicName}", {} ] }, - "MetricName": "Duration", - "Namespace": "AWS/Lambda", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "FunctionName", + "Name": "TopicName", "Value": { - "Ref": "ThrottlerHandler750A7C89" + "Fn::GetAtt": [ + "MyTopic86869434", + "TopicName" + ] } } ], - "Statistic": "Maximum", - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 2850 - } + "MetricName": "NumberOfNotificationsFailed", + "Namespace": "AWS/SNS", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaInvocationsAlarmThrottlerHandler750A7C89": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchSNSNumberOfNotificationsFilteredOutInvalidAttributesAlarmMyTopic86869434": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -6241,39 +4373,42 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Invocations_\${ThrottlerHandler750A7C89}", + "SNS NumberOfNotificationsFilteredOutInvalidAttributes for \${MyTopic86869434.TopicName} breaches 1", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Total invocations for \${ThrottlerHandler750A7C89} breaches 10", + "SNS_NumberOfNotificationsFilteredOutInvalidAttributes_Alarm_\${MyTopic86869434.TopicName}", {} ] }, - "MetricName": "Invocations", - "Namespace": "AWS/Lambda", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "FunctionName", + "Name": "TopicName", "Value": { - "Ref": "ThrottlerHandler750A7C89" + "Fn::GetAtt": [ + "MyTopic86869434", + "TopicName" + ] } } ], - "Statistic": "Sum", - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 10 - } + "MetricName": "NumberOfNotificationsFilteredOut-InvalidAttributes", + "Namespace": "AWS/SNS", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaErrorsAlarmDriveStreamHandler62F1767B": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchSQSInFlightMsgsAlarmDeadLetterQueue9F481546": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -6281,39 +4416,42 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Errors_\${DriveStreamHandler62F1767B}", + "SQS in-flight messages for \${DeadLetterQueue9F481546.QueueName} breaches 1200 (1% of the hard limit of 120000)", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Error count for \${DriveStreamHandler62F1767B} breaches 0", + "SQS_ApproximateNumberOfMessagesNotVisible_\${DeadLetterQueue9F481546.QueueName}", {} ] }, - "MetricName": "Errors", - "Namespace": "AWS/Lambda", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "FunctionName", + "Name": "QueueName", "Value": { - "Ref": "DriveStreamHandler62F1767B" + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "QueueName" + ] } } ], - "Statistic": "Sum", - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + "MetricName": "ApproximateNumberOfMessagesNotVisible", + "Namespace": "AWS/SQS", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 1200, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaThrottlesAlarmDriveStreamHandler62F1767B": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchSQSOldestMsgAgeAlarmDeadLetterQueue9F481546": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -6321,75 +4459,42 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Throttles_\${DriveStreamHandler62F1767B}", + "SQS age of oldest message in the queue \${DeadLetterQueue9F481546.QueueName} breaches 60", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Throttles % for \${DriveStreamHandler62F1767B} breaches 0", + "SQS_ApproximateAgeOfOldestMessage_\${DeadLetterQueue9F481546.QueueName}", {} ] }, - "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 - }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ { - "Id": "invocations", - "MetricStat": { - "Metric": { - "Namespace": "AWS/Lambda", - "MetricName": "Invocations", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "DriveStreamHandler62F1767B" - } - } - ] - }, - "Period": 60, - "Stat": "Sum" - }, - "ReturnData": false + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "QueueName" + ] + } } ], "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + "MetricName": "ApproximateAgeOfOldestMessage", + "Namespace": "AWS/SQS", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 60, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaDurationAlarmDriveStreamHandler62F1767B": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchTableReadThrottleEventsAlarmTableCD117FA1": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -6397,39 +4502,39 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Duration_\${DriveStreamHandler62F1767B}", + "DynamoDB Sum for \${TableCD117FA1} breaches 10", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Max duration for \${DriveStreamHandler62F1767B} breaches 95% of timeout (3)", + "DDB_ReadThrottleEvents_Alarm_\${TableCD117FA1}", {} ] }, - "MetricName": "Duration", - "Namespace": "AWS/Lambda", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "FunctionName", + "Name": "TableName", "Value": { - "Ref": "DriveStreamHandler62F1767B" + "Ref": "TableCD117FA1" } } ], - "Statistic": "Maximum", - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 2850 - } + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaInvocationsAlarmDriveStreamHandler62F1767B": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchTableSystemErrorsAlarmTableCD117FA1": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -6437,39 +4542,79 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 0", + {} + ] + }, "AlarmName": { "Fn::Sub": [ - "Lambda_Invocations_\${DriveStreamHandler62F1767B}", + "DDB_SystemErrors_Alarm_\${TableCD117FA1}", {} ] }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "SystemErrors", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchTableUserErrorsAlarmTableCD117FA1": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], "AlarmDescription": { "Fn::Sub": [ - "Total invocations for \${DriveStreamHandler62F1767B} breaches 10", + "DynamoDB Sum for \${TableCD117FA1} breaches 0", {} ] }, - "MetricName": "Invocations", - "Namespace": "AWS/Lambda", + "AlarmName": { + "Fn::Sub": [ + "DDB_UserErrors_Alarm_\${TableCD117FA1}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "FunctionName", + "Name": "TableName", "Value": { - "Ref": "DriveStreamHandler62F1767B" + "Ref": "TableCD117FA1" } } ], - "Statistic": "Sum", + "EvaluationPeriods": 1, + "MetricName": "UserErrors", + "Namespace": "AWS/DynamoDB", + "OKActions": [], "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 10 - } + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaErrorsAlarmDriveQueueHandler9F657A00": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchTableWriteThrottleEventsAlarmTableCD117FA1": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -6477,708 +4622,1013 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Errors_\${DriveQueueHandler9F657A00}", + "DynamoDB Sum for \${TableCD117FA1} breaches 10", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Error count for \${DriveQueueHandler9F657A00} breaches 0", + "DDB_WriteThrottleEvents_Alarm_\${TableCD117FA1}", {} ] }, - "MetricName": "Errors", - "Namespace": "AWS/Lambda", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "FunctionName", + "Name": "TableName", "Value": { - "Ref": "DriveQueueHandler9F657A00" + "Ref": "TableCD117FA1" } } ], - "Statistic": "Sum", - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaThrottlesAlarmDriveQueueHandler9F657A00": { - "Type": "AWS::CloudWatch::Alarm", + "TableCD117FA1": { + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/Table/Resource" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ + "AttributeDefinitions": [ { - "Ref": "MyTopic86869434" + "AttributeName": "id", + "AttributeType": "S" } ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "Lambda_Throttles_\${DriveQueueHandler9F657A00}", - {} - ] + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ] + }, + "Type": "AWS::DynamoDB::Table", + "UpdateReplacePolicy": "Retain" + }, + "ThrottlerHandler750A7C89": { + "DependsOn": [ + "ThrottlerHandlerServiceRoleA0481DAF" + ], + "Metadata": { + "aws:asset:is-bundled": false, + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:property": "Code", + "aws:cdk:path": "CdkGeneralStackTest-Europe/ThrottlerHandler/Resource" + }, + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-eu-west-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" }, - "AlarmDescription": { - "Fn::Sub": [ - "Throttles % for \${DriveQueueHandler9F657A00} breaches 0", - {} + "Handler": "hello.handler", + "ReservedConcurrentExecutions": 0, + "Role": { + "Fn::GetAtt": [ + "ThrottlerHandlerServiceRoleA0481DAF", + "Arn" ] }, - "Metrics": [ + "Runtime": "nodejs18.x" + }, + "Type": "AWS::Lambda::Function" + }, + "ThrottlerHandlerServiceRoleA0481DAF": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-Europe/ThrottlerHandler/ServiceRole/Resource" + }, + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ { - "Id": "throttles_pc", - "Expression": "(throttles / ( throttles + invocations )) * 100", - "Label": "% Throttles", - "ReturnData": true + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "Type": "AWS::IAM::Role" + } + }, + "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." + } + ] + } + }, + "Transform": "SlicWatch-v3" +} +` + +exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP > the Macro adds SLIC Watch dashboards and alarms to synthesized CDK project > generalUsStack > generalUsStack fragment 1`] = ` +{ + "Metadata": { + "slicWatch": { + "alarmActionsConfig": { + "alarmActions": [ { - "Id": "throttles", - "MetricStat": { - "Metric": { - "Namespace": "AWS/Lambda", - "MetricName": "Throttles", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "DriveQueueHandler9F657A00" - } + "Ref": "MyTopic86869434" + } + ] + }, + "alarms": { + "Lambda": { + "Invocations": { + "enabled": true, + "Threshold": 10 + } + }, + "SQS": { + "AgeOfOldestMessage": { + "enabled": true, + "Statistic": "Maximum", + "Threshold": 60 + }, + "InFlightMessagesPc": { + "Statistic": "Maximum", + "Threshold": 1 + } + } + }, + "enabled": true, + "topicArn": "arn:aws:xxxxxx:mytopic" + } + }, + "Outputs": { + "myapiEndpoint8EB17201": { + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "myapi162F20B8" + }, + ".execute-api.us-east-1.", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/" + ] + ] + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]", + "Type": "AWS::SSM::Parameter::Value" + } + }, + "Resources": { + "CDKMetadata": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/CDKMetadata/Default" + }, + "Properties": { + "Analytics": "v2:deflate64:H4sIAAAAAAAA/02Q30/DIBDH/5a9M9SZmL12Gp801rr3hdKzshaoPdhsGv53D5izCeE+9z24Xxu+feC3K3HGtWy6da9qPn84ITtG0mFGg3ze20FJ9vhpEgTWC103gs/P3kinrImhJZcwaoVIXmBKaD5XtocYiDYwvD8IRHDIi2jI5zsvO3A7gcDEoFrh4CwmPr+kQhWgKwaVEvxjIaX1xrEnGHo7aSAkdeHRFG2qmoG+Wj9KSEXK0f5Mf8olceZXcF+2iVKmwJrJCG0b2ste1HmOBIHBierQfip/Gc+n8b5Jevfgk5Yh3aXtlZyuYnZDuHbG0jpit8q08dmbd4N3y/YCM7YBfsSb092W09msjqjUeqRNKA28yvYXs0P/r9UBAAA=" + }, + "Type": "AWS::CDK::Metadata" + }, + "DeadLetterQueue9F481546": { + "DeletionPolicy": "Delete", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DeadLetterQueue/Resource" + }, + "Type": "AWS::SQS::Queue", + "UpdateReplacePolicy": "Delete" + }, + "DeadLetterQueuePolicyB1FB890C": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DeadLetterQueue/Policy/Resource" + }, + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "sqs:SendMessage", + "Condition": { + "ArnEquals": { + "aws:SourceArn": { + "Fn::GetAtt": [ + "ruleF2C1DCDC", + "Arn" + ] } - ] + } }, - "Period": 60, - "Stat": "Sum" - }, - "ReturnData": false - }, - { - "Id": "invocations", - "MetricStat": { - "Metric": { - "Namespace": "AWS/Lambda", - "MetricName": "Invocations", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "DriveQueueHandler9F657A00" - } - } + "Effect": "Allow", + "Principal": { + "Service": "events.amazonaws.com" + }, + "Resource": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "Arn" ] }, - "Period": 60, - "Stat": "Sum" - }, - "ReturnData": false + "Sid": "AllowEventRuleCdkGeneralStackTestUSruleB0D09E87" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "DeadLetterQueue9F481546" } - ], - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + ] + }, + "Type": "AWS::SQS::QueuePolicy" }, - "slicWatchLambdaDurationAlarmDriveQueueHandler9F657A00": { - "Type": "AWS::CloudWatch::Alarm", + "DriveQueueHandler9F657A00": { + "DependsOn": [ + "DriveQueueHandlerServiceRoleD796850A" + ], + "Metadata": { + "aws:asset:is-bundled": false, + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:property": "Code", + "aws:cdk:path": "CdkGeneralStackTest-US/DriveQueueHandler/Resource" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" - } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "Lambda_Duration_\${DriveQueueHandler9F657A00}", - {} - ] + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" }, - "AlarmDescription": { - "Fn::Sub": [ - "Max duration for \${DriveQueueHandler9F657A00} breaches 95% of timeout (3)", - {} + "Handler": "hello.handler", + "Role": { + "Fn::GetAtt": [ + "DriveQueueHandlerServiceRoleD796850A", + "Arn" ] }, - "MetricName": "Duration", - "Namespace": "AWS/Lambda", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "DriveQueueHandler9F657A00" - } - } - ], - "Statistic": "Maximum", - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 2850 - } + "Runtime": "nodejs18.x" + }, + "Type": "AWS::Lambda::Function" }, - "slicWatchLambdaInvocationsAlarmDriveQueueHandler9F657A00": { - "Type": "AWS::CloudWatch::Alarm", + "DriveQueueHandlerServiceRoleD796850A": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveQueueHandler/ServiceRole/Resource" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ { - "Ref": "MyTopic86869434" + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "Lambda_Invocations_\${DriveQueueHandler9F657A00}", - {} - ] + ] + }, + "Type": "AWS::IAM::Role" + }, + "DriveStreamHandler62F1767B": { + "DependsOn": [ + "DriveStreamHandlerServiceRoleD2BAFDD4" + ], + "Metadata": { + "aws:asset:is-bundled": false, + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:property": "Code", + "aws:cdk:path": "CdkGeneralStackTest-US/DriveStreamHandler/Resource" + }, + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" }, - "AlarmDescription": { - "Fn::Sub": [ - "Total invocations for \${DriveQueueHandler9F657A00} breaches 10", - {} + "Handler": "stream-test-handler.handleDrive", + "Role": { + "Fn::GetAtt": [ + "DriveStreamHandlerServiceRoleD2BAFDD4", + "Arn" ] }, - "MetricName": "Invocations", - "Namespace": "AWS/Lambda", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "DriveQueueHandler9F657A00" - } - } - ], - "Statistic": "Sum", - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 10 - } + "Runtime": "nodejs18.x" + }, + "Type": "AWS::Lambda::Function" }, - "slicWatchLambdaErrorsAlarmDriveTableHandler119966B0": { - "Type": "AWS::CloudWatch::Alarm", + "DriveStreamHandlerServiceRoleD2BAFDD4": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveStreamHandler/ServiceRole/Resource" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ { - "Ref": "MyTopic86869434" + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "Lambda_Errors_\${DriveTableHandler119966B0}", - {} - ] + ] + }, + "Type": "AWS::IAM::Role" + }, + "DriveTableHandler119966B0": { + "DependsOn": [ + "DriveTableHandlerServiceRoleDDA3FBE1" + ], + "Metadata": { + "aws:asset:is-bundled": false, + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:property": "Code", + "aws:cdk:path": "CdkGeneralStackTest-US/DriveTableHandler/Resource" + }, + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" }, - "AlarmDescription": { - "Fn::Sub": [ - "Error count for \${DriveTableHandler119966B0} breaches 0", - {} + "Handler": "hello.handler", + "Role": { + "Fn::GetAtt": [ + "DriveTableHandlerServiceRoleDDA3FBE1", + "Arn" ] }, - "MetricName": "Errors", - "Namespace": "AWS/Lambda", - "Dimensions": [ + "Runtime": "nodejs18.x" + }, + "Type": "AWS::Lambda::Function" + }, + "DriveTableHandlerServiceRoleDDA3FBE1": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/DriveTableHandler/ServiceRole/Resource" + }, + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ { - "Name": "FunctionName", - "Value": { - "Ref": "DriveTableHandler119966B0" - } + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] } - ], - "Statistic": "Sum", - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + ] + }, + "Type": "AWS::IAM::Role" }, - "slicWatchLambdaThrottlesAlarmDriveTableHandler119966B0": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" + "HelloHandler2E4FBA4D": { + "DependsOn": [ + "HelloHandlerServiceRole11EF7C63" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 4 + } + } } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "Lambda_Throttles_\${DriveTableHandler119966B0}", - {} - ] + } + }, + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" }, - "AlarmDescription": { - "Fn::Sub": [ - "Throttles % for \${DriveTableHandler119966B0} breaches 0", - {} + "Handler": "hello.handler", + "Role": { + "Fn::GetAtt": [ + "HelloHandlerServiceRole11EF7C63", + "Arn" ] }, - "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 - } + "Runtime": "nodejs18.x" + }, + "Type": "AWS::Lambda::Function" }, - "slicWatchLambdaDurationAlarmDriveTableHandler119966B0": { - "Type": "AWS::CloudWatch::Alarm", + "HelloHandlerServiceRole11EF7C63": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/HelloHandler/ServiceRole/Resource" + }, "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)", - {} - ] + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" }, - "MetricName": "Duration", - "Namespace": "AWS/Lambda", - "Dimensions": [ + "ManagedPolicyArns": [ { - "Name": "FunctionName", - "Value": { - "Ref": "DriveTableHandler119966B0" - } + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] } - ], - "Statistic": "Maximum", - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 2850 - } + ] + }, + "Type": "AWS::IAM::Role" }, - "slicWatchLambdaInvocationsAlarmDriveTableHandler119966B0": { - "Type": "AWS::CloudWatch::Alarm", + "myapi162F20B8": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Resource" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" - } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "Lambda_Invocations_\${DriveTableHandler119966B0}", - {} + "Name": "myapi" + }, + "Type": "AWS::ApiGateway::RestApi" + }, + "myapiAccountC3A4750C": { + "DeletionPolicy": "Retain", + "DependsOn": [ + "myapi162F20B8" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Account" + }, + "Properties": { + "CloudWatchRoleArn": { + "Fn::GetAtt": [ + "myapiCloudWatchRoleEB425128", + "Arn" ] + } + }, + "Type": "AWS::ApiGateway::Account", + "UpdateReplacePolicy": "Retain" + }, + "myapiANY111D56B7": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/ANY/Resource" + }, + "Properties": { + "AuthorizationType": "NONE", + "HttpMethod": "ANY", + "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" + ] + ] + } }, - "AlarmDescription": { - "Fn::Sub": [ - "Total invocations for \${DriveTableHandler119966B0} breaches 10", - {} + "ResourceId": { + "Fn::GetAtt": [ + "myapi162F20B8", + "RootResourceId" ] }, - "MetricName": "Invocations", - "Namespace": "AWS/Lambda", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "DriveTableHandler119966B0" - } - } - ], - "Statistic": "Sum", - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 10 - } + "RestApiId": { + "Ref": "myapi162F20B8" + } + }, + "Type": "AWS::ApiGateway::Method" }, - "slicWatchApi5XXErrorAlarmmyapi": { - "Type": "AWS::CloudWatch::Alarm", + "myapiANYApiPermissionCdkGeneralStackTestUSmyapi9E6CC024ANY52E5EFEE": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/ANY/ApiPermission.CdkGeneralStackTestUSmyapi9E6CC024.ANY.." + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" - } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "ApiGW_5XXError_myapi", - {} + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" ] }, - "AlarmDescription": { - "Fn::Sub": [ - "API Gateway 5XXError Average for myapi breaches 0", - {} + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/*/" + ] ] - }, - "MetricName": "5XXError", - "Namespace": "AWS/ApiGateway", - "Dimensions": [ - { - "Name": "ApiName", - "Value": "myapi" - } - ], - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Average", - "Threshold": 0 - } + } + }, + "Type": "AWS::Lambda::Permission" }, - "slicWatchApi4XXErrorAlarmmyapi": { - "Type": "AWS::CloudWatch::Alarm", + "myapiANYApiPermissionTestCdkGeneralStackTestUSmyapi9E6CC024ANY1136CBF8": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/ANY/ApiPermission.Test.CdkGeneralStackTestUSmyapi9E6CC024.ANY.." + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" - } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "ApiGW_4XXError_myapi", - {} + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" ] }, - "AlarmDescription": { - "Fn::Sub": [ - "API Gateway 4XXError Average for myapi breaches 0.05", - {} + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/test-invoke-stage/*/" + ] ] + } + }, + "Type": "AWS::Lambda::Permission" + }, + "myapiCloudWatchRoleEB425128": { + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/CloudWatchRole/Resource" + }, + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" }, - "MetricName": "4XXError", - "Namespace": "AWS/ApiGateway", - "Dimensions": [ + "ManagedPolicyArns": [ { - "Name": "ApiName", - "Value": "myapi" + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" + ] + ] } - ], - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Average", - "Threshold": 0.05 - } + ] + }, + "Type": "AWS::IAM::Role", + "UpdateReplacePolicy": "Retain" }, - "slicWatchApiLatencyAlarmmyapi": { - "Type": "AWS::CloudWatch::Alarm", + "myapiDeploymentB7EF8EB7fea2aa51ab5416f81a0b318c3a85d817": { + "DependsOn": [ + "myapiproxyANYDD7FCE64", + "myapiproxyB6DF4575", + "myapiANY111D56B7" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Deployment/Resource" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" - } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "ApiGW_Latency_myapi", - {} + "Description": "Automatically created by the RestApi construct", + "RestApiId": { + "Ref": "myapi162F20B8" + } + }, + "Type": "AWS::ApiGateway::Deployment" + }, + "myapiDeploymentStageprod329F21FF": { + "DependsOn": [ + "myapiAccountC3A4750C" + ], + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/DeploymentStage.prod/Resource" + }, + "Properties": { + "DeploymentId": { + "Ref": "myapiDeploymentB7EF8EB7fea2aa51ab5416f81a0b318c3a85d817" + }, + "RestApiId": { + "Ref": "myapi162F20B8" + }, + "StageName": "prod" + }, + "Type": "AWS::ApiGateway::Stage" + }, + "myapiproxyANYApiPermissionCdkGeneralStackTestUSmyapi9E6CC024ANYproxy61FC0812": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/ANY/ApiPermission.CdkGeneralStackTestUSmyapi9E6CC024.ANY..{proxy+}" + }, + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" ] }, - "AlarmDescription": { - "Fn::Sub": [ - "API Gateway Latency p99 for myapi breaches 5000", - {} + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/", + { + "Ref": "myapiDeploymentStageprod329F21FF" + }, + "/*/*" + ] ] - }, - "MetricName": "Latency", - "Namespace": "AWS/ApiGateway", - "Dimensions": [ - { - "Name": "ApiName", - "Value": "myapi" - } - ], - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "ExtendedStatistic": "p99", - "Threshold": 5000 - } + } + }, + "Type": "AWS::Lambda::Permission" }, - "slicWatchTableReadThrottleEventsAlarmTableCD117FA1": { - "Type": "AWS::CloudWatch::Alarm", + "myapiproxyANYApiPermissionTestCdkGeneralStackTestUSmyapi9E6CC024ANYproxy352B4E19": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/ANY/ApiPermission.Test.CdkGeneralStackTestUSmyapi9E6CC024.ANY..{proxy+}" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" - } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "DDB_ReadThrottleEvents_Alarm_\${TableCD117FA1}", - {} + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" ] }, - "AlarmDescription": { - "Fn::Sub": [ - "DynamoDB Sum for \${TableCD117FA1} breaches 10", - {} + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "myapi162F20B8" + }, + "/test-invoke-stage/*/*" + ] ] - }, - "MetricName": "ReadThrottleEvents", - "Namespace": "AWS/DynamoDB", - "Dimensions": [ - { - "Name": "TableName", - "Value": { - "Ref": "TableCD117FA1" - } - } - ], - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 10 - } + } + }, + "Type": "AWS::Lambda::Permission" }, - "slicWatchTableWriteThrottleEventsAlarmTableCD117FA1": { - "Type": "AWS::CloudWatch::Alarm", + "myapiproxyANYDD7FCE64": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/ANY/Resource" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" + "AuthorizationType": "NONE", + "HttpMethod": "ANY", + "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" + ] + ] } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "DDB_WriteThrottleEvents_Alarm_\${TableCD117FA1}", - {} - ] }, - "AlarmDescription": { - "Fn::Sub": [ - "DynamoDB Sum for \${TableCD117FA1} breaches 10", - {} - ] + "ResourceId": { + "Ref": "myapiproxyB6DF4575" }, - "MetricName": "WriteThrottleEvents", - "Namespace": "AWS/DynamoDB", - "Dimensions": [ - { - "Name": "TableName", - "Value": { - "Ref": "TableCD117FA1" - } - } - ], - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 10 - } + "RestApiId": { + "Ref": "myapi162F20B8" + } + }, + "Type": "AWS::ApiGateway::Method" }, - "slicWatchTableUserErrorsAlarmTableCD117FA1": { - "Type": "AWS::CloudWatch::Alarm", + "myapiproxyB6DF4575": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/myapi/Default/{proxy+}/Resource" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" - } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "DDB_UserErrors_Alarm_\${TableCD117FA1}", - {} - ] - }, - "AlarmDescription": { - "Fn::Sub": [ - "DynamoDB Sum for \${TableCD117FA1} breaches 0", - {} + "ParentId": { + "Fn::GetAtt": [ + "myapi162F20B8", + "RootResourceId" ] }, - "MetricName": "UserErrors", - "Namespace": "AWS/DynamoDB", - "Dimensions": [ - { - "Name": "TableName", - "Value": { - "Ref": "TableCD117FA1" - } - } - ], - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 0 - } + "PathPart": "{proxy+}", + "RestApiId": { + "Ref": "myapi162F20B8" + } + }, + "Type": "AWS::ApiGateway::Resource" }, - "slicWatchTableSystemErrorsAlarmTableCD117FA1": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" + "MyTopic86869434": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/MyTopic/Resource" + }, + "Type": "AWS::SNS::Topic" + }, + "PingHandler50068074": { + "DependsOn": [ + "PingHandlerServiceRole46086423" + ], + "Metadata": { + "slicWatch": { + "dashboard": { + "enabled": false } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "DDB_SystemErrors_Alarm_\${TableCD117FA1}", - {} - ] + } + }, + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" }, - "AlarmDescription": { - "Fn::Sub": [ - "DynamoDB Sum for \${TableCD117FA1} breaches 0", - {} + "Handler": "hello.handler", + "Role": { + "Fn::GetAtt": [ + "PingHandlerServiceRole46086423", + "Arn" ] }, - "MetricName": "SystemErrors", - "Namespace": "AWS/DynamoDB", - "Dimensions": [ + "Runtime": "nodejs18.x" + }, + "Type": "AWS::Lambda::Function" + }, + "PingHandlerServiceRole46086423": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/PingHandler/ServiceRole/Resource" + }, + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ { - "Name": "TableName", - "Value": { - "Ref": "TableCD117FA1" - } + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] } - ], - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 0 - } + ] + }, + "Type": "AWS::IAM::Role" }, - "slicWatchSQSInFlightMsgsAlarmDeadLetterQueue9F481546": { - "Type": "AWS::CloudWatch::Alarm", + "ruleAllowEventRuleCdkGeneralStackTestUSHelloHandlerC75B8B54C6DD839C": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/rule/AllowEventRuleCdkGeneralStackTestUSHelloHandlerC75B8B54" + }, "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" - } - ], - "OKActions": [], - "AlarmName": { - "Fn::Sub": [ - "SQS_ApproximateNumberOfMessagesNotVisible_\${DeadLetterQueue9F481546.QueueName}", - {} + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" ] }, - "AlarmDescription": { - "Fn::Sub": [ - "SQS in-flight messages for \${DeadLetterQueue9F481546.QueueName} breaches 1200 (1% of the hard limit of 120000)", - {} + "Principal": "events.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "ruleF2C1DCDC", + "Arn" + ] + } + }, + "Type": "AWS::Lambda::Permission" + }, + "ruleF2C1DCDC": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/rule/Resource" + }, + "Properties": { + "EventPattern": { + "source": [ + "aws.ec2" ] }, - "MetricName": "ApproximateNumberOfMessagesNotVisible", - "Namespace": "AWS/SQS", - "Dimensions": [ + "State": "ENABLED", + "Targets": [ { - "Name": "QueueName", - "Value": { + "Arn": { "Fn::GetAtt": [ - "DeadLetterQueue9F481546", - "QueueName" + "HelloHandler2E4FBA4D", + "Arn" ] + }, + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "Arn" + ] + } + }, + "Id": "Target0", + "RetryPolicy": { + "MaximumEventAgeInSeconds": 7200, + "MaximumRetryAttempts": 2 } } - ], - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Maximum", - "Threshold": 1200 - } + ] + }, + "Type": "AWS::Events::Rule" }, - "slicWatchSQSOldestMsgAgeAlarmDeadLetterQueue9F481546": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchApi4XXErrorAlarmmyapi": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -7186,85 +5636,37 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "SQS_ApproximateAgeOfOldestMessage_\${DeadLetterQueue9F481546.QueueName}", + "API Gateway 4XXError Average for myapi breaches 0.05", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "SQS age of oldest message in the queue \${DeadLetterQueue9F481546.QueueName} breaches 60", + "ApiGW_4XXError_myapi", {} ] }, - "MetricName": "ApproximateAgeOfOldestMessage", - "Namespace": "AWS/SQS", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "QueueName", - "Value": { - "Fn::GetAtt": [ - "DeadLetterQueue9F481546", - "QueueName" - ] - } + "Name": "ApiName", + "Value": "myapi" } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Maximum", - "Threshold": 60 - } - }, - "slicWatchSNSNumberOfNotificationsFilteredOutInvalidAttributesAlarmMyTopic86869434": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - { - "Ref": "MyTopic86869434" - } - ], + "MetricName": "4XXError", + "Namespace": "AWS/ApiGateway", "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 - } + "Statistic": "Average", + "Threshold": 0.05, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchSNSNumberOfNotificationsFailedAlarmMyTopic86869434": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchApi5XXErrorAlarmmyapi": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -7272,82 +5674,37 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "MetricName": "NumberOfNotificationsFailed", - "Namespace": "AWS/SNS", - "Dimensions": [ - { - "Name": "TopicName", - "Value": { - "Fn::GetAtt": [ - "MyTopic86869434", - "TopicName" - ] - } - } - ], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "SNS_NumberOfNotificationsFailed_Alarm_\${MyTopic86869434.TopicName}", + "API Gateway 5XXError Average for myapi breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "SNS NumberOfNotificationsFailed for \${MyTopic86869434.TopicName} breaches 1", + "ApiGW_5XXError_myapi", {} ] }, - "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" - } + "Name": "ApiName", + "Value": "myapi" } ], - "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 - } + "MetricName": "5XXError", + "Namespace": "AWS/ApiGateway", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchEventsThrottledRulesAlarmRuleF2C1DCDC": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchApiLatencyAlarmmyapi": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ @@ -7355,39 +5712,37 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Ref": "MyTopic86869434" } ], - "OKActions": [], - "MetricName": "ThrottledRules", - "Namespace": "AWS/Events", - "Dimensions": [ - { - "Name": "RuleName", - "Value": { - "Ref": "ruleF2C1DCDC" - } - } - ], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Events_ThrottledRules_Alarm_\${ruleF2C1DCDC}", + "API Gateway Latency p99 for myapi breaches 5000", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "EventBridge ThrottledRules for \${ruleF2C1DCDC} breaches 1", + "ApiGW_Latency_myapi", {} ] }, - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 1 - } + "Dimensions": [ + { + "Name": "ApiName", + "Value": "myapi" + } + ], + "EvaluationPeriods": 1, + "ExtendedStatistic": "p99", + "MetricName": "Latency", + "Namespace": "AWS/ApiGateway", + "OKActions": [], + "Period": 60, + "Threshold": 5000, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, "slicWatchDashboard": { - "Type": "AWS::CloudWatch::Dashboard", "Properties": { "DashboardBody": { "Fn::Sub": { @@ -7595,28 +5950,268 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "TableName", "\${TableCD117FA1}", { - "stat": "Sum" + "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/DynamoDB", - "WriteThrottleEvents", - "TableName", - "\${TableCD117FA1}", + "AWS/Lambda", + "Duration", + "FunctionName", + "\${DriveTableHandler119966B0}", { - "stat": "Sum" + "stat": "p95" } ] ], - "title": "WriteThrottleEvents Table \${TableCD117FA1}", + "title": "Lambda Duration p95 per Function", "view": "timeSeries", "region": "\${AWS::Region}", "period": 300 }, "width": 8, "height": 6, - "x": 16, - "y": 6 + "x": 0, + "y": 18 }, { "type": "metric", @@ -7624,59 +6219,59 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "metrics": [ [ "AWS/Lambda", - "Errors", + "Duration", "FunctionName", "\${HelloHandler2E4FBA4D}", { - "stat": "Sum" + "stat": "Maximum" } ], [ "AWS/Lambda", - "Errors", + "Duration", "FunctionName", "\${ThrottlerHandler750A7C89}", { - "stat": "Sum" + "stat": "Maximum" } ], [ "AWS/Lambda", - "Errors", + "Duration", "FunctionName", "\${DriveStreamHandler62F1767B}", { - "stat": "Sum" + "stat": "Maximum" } ], [ "AWS/Lambda", - "Errors", + "Duration", "FunctionName", "\${DriveQueueHandler9F657A00}", { - "stat": "Sum" + "stat": "Maximum" } ], [ "AWS/Lambda", - "Errors", + "Duration", "FunctionName", "\${DriveTableHandler119966B0}", { - "stat": "Sum" + "stat": "Maximum" } ] ], - "title": "Lambda Errors Sum per Function", + "title": "Lambda Duration Maximum per Function", "view": "timeSeries", "region": "\${AWS::Region}", "period": 300 }, "width": 8, "height": 6, - "x": 0, - "y": 12 + "x": 8, + "y": 18 }, { "type": "metric", @@ -7684,7 +6279,7 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "metrics": [ [ "AWS/Lambda", - "Throttles", + "Invocations", "FunctionName", "\${HelloHandler2E4FBA4D}", { @@ -7693,7 +6288,7 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP ], [ "AWS/Lambda", - "Throttles", + "Invocations", "FunctionName", "\${ThrottlerHandler750A7C89}", { @@ -7702,7 +6297,7 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP ], [ "AWS/Lambda", - "Throttles", + "Invocations", "FunctionName", "\${DriveStreamHandler62F1767B}", { @@ -7711,7 +6306,7 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP ], [ "AWS/Lambda", - "Throttles", + "Invocations", "FunctionName", "\${DriveQueueHandler9F657A00}", { @@ -7720,7 +6315,7 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP ], [ "AWS/Lambda", - "Throttles", + "Invocations", "FunctionName", "\${DriveTableHandler119966B0}", { @@ -7728,15 +6323,15 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP } ] ], - "title": "Lambda Throttles Sum per Function", + "title": "Lambda Invocations Sum per Function", "view": "timeSeries", "region": "\${AWS::Region}", "period": 300 }, "width": 8, "height": 6, - "x": 8, - "y": 12 + "x": 16, + "y": 18 }, { "type": "metric", @@ -7744,500 +6339,1904 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "metrics": [ [ "AWS/Lambda", - "Duration", + "ConcurrentExecutions", "FunctionName", "\${HelloHandler2E4FBA4D}", { - "stat": "Average" + "stat": "Maximum" } ], [ "AWS/Lambda", - "Duration", + "ConcurrentExecutions", "FunctionName", "\${ThrottlerHandler750A7C89}", { - "stat": "Average" + "stat": "Maximum" } ], [ "AWS/Lambda", - "Duration", + "ConcurrentExecutions", "FunctionName", "\${DriveStreamHandler62F1767B}", { - "stat": "Average" + "stat": "Maximum" } ], [ "AWS/Lambda", - "Duration", + "ConcurrentExecutions", "FunctionName", "\${DriveQueueHandler9F657A00}", { - "stat": "Average" + "stat": "Maximum" } ], [ "AWS/Lambda", - "Duration", + "ConcurrentExecutions", "FunctionName", "\${DriveTableHandler119966B0}", { - "stat": "Average" + "stat": "Maximum" } ] ], - "title": "Lambda Duration Average per Function", + "title": "Lambda ConcurrentExecutions Maximum per Function", "view": "timeSeries", "region": "\${AWS::Region}", "period": 300 }, "width": 8, "height": 6, - "x": 16, - "y": 12 + "x": 0, + "y": 24 }, { "type": "metric", "properties": { "metrics": [ [ - "AWS/Lambda", - "Duration", - "FunctionName", - "\${HelloHandler2E4FBA4D}", + "AWS/SQS", + "NumberOfMessagesSent", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", { - "stat": "p95" + "stat": "Sum" } ], [ - "AWS/Lambda", - "Duration", - "FunctionName", - "\${ThrottlerHandler750A7C89}", + "AWS/SQS", + "NumberOfMessagesReceived", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", { - "stat": "p95" + "stat": "Sum" } ], [ - "AWS/Lambda", - "Duration", - "FunctionName", - "\${DriveStreamHandler62F1767B}", + "AWS/SQS", + "NumberOfMessagesDeleted", + "QueueName", + "\${DeadLetterQueue9F481546.QueueName}", { - "stat": "p95" + "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/Lambda", - "Duration", - "FunctionName", - "\${DriveQueueHandler9F657A00}", + "AWS/SNS", + "NumberOfNotificationsFailed", + "TopicName", + "\${MyTopic86869434.TopicName}", { - "stat": "p95" + "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/Lambda", - "Duration", - "FunctionName", - "\${DriveTableHandler119966B0}", + "AWS/Events", + "ThrottledRules", + "RuleName", + "\${ruleF2C1DCDC}", { - "stat": "p95" + "stat": "Sum" + } + ], + [ + "AWS/Events", + "Invocations", + "RuleName", + "\${ruleF2C1DCDC}", + { + "stat": "Sum" } ] ], - "title": "Lambda Duration p95 per Function", + "title": "EventBridge Rule \${ruleF2C1DCDC}", "view": "timeSeries", "region": "\${AWS::Region}", "period": 300 }, "width": 8, "height": 6, - "x": 0, - "y": 18 + "x": 16, + "y": 30 + } + ] + } + } + }, + "Type": "AWS::CloudWatch::Dashboard" + }, + "slicWatchEventsFailedInvocationsAlarmRuleF2C1DCDC": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge FailedInvocations for \${ruleF2C1DCDC} breaches 1", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Events_FailedInvocations_Alarm_\${ruleF2C1DCDC}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "ruleF2C1DCDC" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "FailedInvocations", + "Namespace": "AWS/Events", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchEventsThrottledRulesAlarmRuleF2C1DCDC": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge ThrottledRules for \${ruleF2C1DCDC} breaches 1", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Events_ThrottledRules_Alarm_\${ruleF2C1DCDC}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "ruleF2C1DCDC" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ThrottledRules", + "Namespace": "AWS/Events", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmDriveQueueHandler9F657A00": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${DriveQueueHandler9F657A00} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${DriveQueueHandler9F657A00}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmDriveStreamHandler62F1767B": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${DriveStreamHandler62F1767B} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmDriveTableHandler119966B0": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${DriveTableHandler119966B0} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${DriveTableHandler119966B0}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmHelloHandler2E4FBA4D": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${HelloHandler2E4FBA4D} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmPingHandler50068074": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${PingHandler50068074} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${PingHandler50068074}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmThrottlerHandler750A7C89": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${ThrottlerHandler750A7C89} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmDriveQueueHandler9F657A00": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${DriveQueueHandler9F657A00} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${DriveQueueHandler9F657A00}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmDriveStreamHandler62F1767B": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${DriveStreamHandler62F1767B} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmDriveTableHandler119966B0": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${DriveTableHandler119966B0} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${DriveTableHandler119966B0}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmHelloHandler2E4FBA4D": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${HelloHandler2E4FBA4D} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmPingHandler50068074": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${PingHandler50068074} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${PingHandler50068074}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmThrottlerHandler750A7C89": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${ThrottlerHandler750A7C89} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmDriveQueueHandler9F657A00": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${DriveQueueHandler9F657A00} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${DriveQueueHandler9F657A00}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmDriveStreamHandler62F1767B": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${DriveStreamHandler62F1767B} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveStreamHandler62F1767B" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmDriveTableHandler119966B0": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${DriveTableHandler119966B0} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${DriveTableHandler119966B0}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmHelloHandler2E4FBA4D": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${HelloHandler2E4FBA4D} breaches 4", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 4, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmPingHandler50068074": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${PingHandler50068074} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${PingHandler50068074}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmThrottlerHandler750A7C89": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${ThrottlerHandler750A7C89} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmDriveQueueHandler9F657A00": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${DriveQueueHandler9F657A00} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${DriveQueueHandler9F657A00}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveQueueHandler9F657A00" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "OKActions": [], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmDriveStreamHandler62F1767B": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${DriveStreamHandler62F1767B} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${DriveStreamHandler62F1767B}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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 + } + ], + "OKActions": [], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmDriveTableHandler119966B0": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${DriveTableHandler119966B0} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${DriveTableHandler119966B0}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "DriveTableHandler119966B0" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "OKActions": [], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmHelloHandler2E4FBA4D": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${HelloHandler2E4FBA4D} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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 + } + ], + "OKActions": [], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmPingHandler50068074": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${PingHandler50068074} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${PingHandler50068074}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "PingHandler50068074" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "OKActions": [], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmThrottlerHandler750A7C89": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${ThrottlerHandler750A7C89} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${ThrottlerHandler750A7C89}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ThrottlerHandler750A7C89" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "OKActions": [], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchSNSNumberOfNotificationsFailedAlarmMyTopic86869434": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFailed for \${MyTopic86869434.TopicName} breaches 1", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFailed_Alarm_\${MyTopic86869434.TopicName}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "MyTopic86869434", + "TopicName" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "NumberOfNotificationsFailed", + "Namespace": "AWS/SNS", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchSNSNumberOfNotificationsFilteredOutInvalidAttributesAlarmMyTopic86869434": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFilteredOutInvalidAttributes for \${MyTopic86869434.TopicName} breaches 1", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFilteredOutInvalidAttributes_Alarm_\${MyTopic86869434.TopicName}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "MyTopic86869434", + "TopicName" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "NumberOfNotificationsFilteredOut-InvalidAttributes", + "Namespace": "AWS/SNS", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchSQSInFlightMsgsAlarmDeadLetterQueue9F481546": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "SQS in-flight messages for \${DeadLetterQueue9F481546.QueueName} breaches 1200 (1% of the hard limit of 120000)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateNumberOfMessagesNotVisible_\${DeadLetterQueue9F481546.QueueName}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "QueueName" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ApproximateNumberOfMessagesNotVisible", + "Namespace": "AWS/SQS", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 1200, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchSQSOldestMsgAgeAlarmDeadLetterQueue9F481546": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "SQS age of oldest message in the queue \${DeadLetterQueue9F481546.QueueName} breaches 60", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateAgeOfOldestMessage_\${DeadLetterQueue9F481546.QueueName}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "DeadLetterQueue9F481546", + "QueueName" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ApproximateAgeOfOldestMessage", + "Namespace": "AWS/SQS", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 60, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchTableReadThrottleEventsAlarmTableCD117FA1": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "DDB_ReadThrottleEvents_Alarm_\${TableCD117FA1}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchTableSystemErrorsAlarmTableCD117FA1": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "DDB_SystemErrors_Alarm_\${TableCD117FA1}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "SystemErrors", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchTableUserErrorsAlarmTableCD117FA1": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "DDB_UserErrors_Alarm_\${TableCD117FA1}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "UserErrors", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchTableWriteThrottleEventsAlarmTableCD117FA1": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MyTopic86869434" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${TableCD117FA1} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "DDB_WriteThrottleEvents_Alarm_\${TableCD117FA1}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "TableCD117FA1" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "TableCD117FA1": { + "DeletionPolicy": "Retain", + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/Table/Resource" + }, + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ] + }, + "Type": "AWS::DynamoDB::Table", + "UpdateReplacePolicy": "Retain" + }, + "ThrottlerHandler750A7C89": { + "DependsOn": [ + "ThrottlerHandlerServiceRoleA0481DAF" + ], + "Metadata": { + "aws:asset:is-bundled": false, + "aws:asset:path": "asset.03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640", + "aws:asset:property": "Code", + "aws:cdk:path": "CdkGeneralStackTest-US/ThrottlerHandler/Resource" + }, + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-us-east-1" + }, + "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" + }, + "Handler": "hello.handler", + "ReservedConcurrentExecutions": 0, + "Role": { + "Fn::GetAtt": [ + "ThrottlerHandlerServiceRoleA0481DAF", + "Arn" + ] + }, + "Runtime": "nodejs18.x" + }, + "Type": "AWS::Lambda::Function" + }, + "ThrottlerHandlerServiceRoleA0481DAF": { + "Metadata": { + "aws:cdk:path": "CdkGeneralStackTest-US/ThrottlerHandler/ServiceRole/Resource" + }, + "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" + ] ] } - } - } - } - }, - "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]" + }, + "Type": "AWS::IAM::Role" } }, "Rules": { @@ -8266,16 +8265,15 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP } ] } - } + }, + "Transform": "SlicWatch-v3" } ` exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP > the Macro adds SLIC Watch dashboards and alarms to synthesized CDK project > stepFunctionStack > stepFunctionStack fragment 1`] = ` { - "Transform": "SlicWatch-v3", "Metadata": { "slicWatch": { - "enabled": true, "alarms": { "Lambda": { "Invocations": { @@ -8285,8 +8283,8 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP }, "SQS": { "AgeOfOldestMessage": { - "Statistic": "Maximum", "enabled": true, + "Statistic": "Maximum", "Threshold": 60 }, "InFlightMessagesPc": { @@ -8295,54 +8293,44 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP } } }, + "enabled": true, "topicArn": { "Ref": "MyTopic86869434" } } }, + "Parameters": { + "BootstrapVersion": { + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]", + "Type": "AWS::SSM::Parameter::Value" + } + }, "Resources": { - "MyTopic86869434": { - "Type": "AWS::SNS::Topic", + "CDKMetadata": { "Metadata": { - "aws:cdk:path": "CdkSFNStackTest-Europe/MyTopic/Resource" - } - }, - "HelloHandlerServiceRole11EF7C63": { - "Type": "AWS::IAM::Role", + "aws:cdk:path": "CdkSFNStackTest-Europe/CDKMetadata/Default" + }, "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" + "Analytics": "v2:deflate64:H4sIAAAAAAAA/11P0UoDQQz8lr7nolaQvtpCoaAgp+Djke6lbbp7u6XZq8iy/+7etoIIgZnJhEwyx8UT3s/oSxvT28bJFtN7JGOhtLqkXjF9hJMYWO18JRkcDdueMK1Hb6IEP1m/PIPQgKkNjqd2xbfgxHxP8soy6GNHqhwVnycoGpejsRyXpAwa+bS77dMuklrFl5q58Zdg/w1g+iSJsCZxsDoEMQzlgcivZA7i6xV/dc7QsobxXOZqeDH34vf12puRwYee8ah3l4cFlprPjirSnEcfZWBsr/gDsE52pTwBAAA=" + }, + "Type": "AWS::CDK::Metadata" + }, + "HelloHandler2E4FBA4D": { + "DependsOn": [ + "HelloHandlerServiceRole11EF7C63" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 4 } } - ], - "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": { @@ -8350,32 +8338,21 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP }, "S3Key": "03015a4df782c6ac9c6d09c548490f98a81c69c44e4262ca4c99d29652f52640.zip" }, + "Handler": "hello.handler", "Role": { "Fn::GetAtt": [ "HelloHandlerServiceRole11EF7C63", "Arn" ] }, - "Handler": "hello.handler", "Runtime": "nodejs18.x" }, - "DependsOn": [ - "HelloHandlerServiceRole11EF7C63" - ], - "Metadata": { - "slicWatch": { - "alarms": { - "Lambda": { - "Invocations": { - "Threshold": 4 - } - } - } - } - } + "Type": "AWS::Lambda::Function" }, - "StateMachineRoleB840431D": { - "Type": "AWS::IAM::Role", + "HelloHandlerServiceRole11EF7C63": { + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/HelloHandler/ServiceRole/Resource" + }, "Properties": { "AssumeRolePolicyDocument": { "Statement": [ @@ -8383,152 +8360,379 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { - "Service": "states.eu-west-1.amazonaws.com" + "Service": "lambda.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": [ + }, + "ManagedPolicyArns": [ { - "Ref": "StateMachineRoleB840431D" + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] } ] }, + "Type": "AWS::IAM::Role" + }, + "MyTopic86869434": { "Metadata": { - "aws:cdk:path": "CdkSFNStackTest-Europe/StateMachine/Role/DefaultPolicy/Resource" - } + "aws:cdk:path": "CdkSFNStackTest-Europe/MyTopic/Resource" + }, + "Type": "AWS::SNS::Topic" }, - "StateMachine2E01A3A5": { - "Type": "AWS::StepFunctions::StateMachine", + "slicWatchDashboard": { "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:", + "DashboardBody": { + "Fn::Sub": { + "start": "-PT3H", + "widgets": [ { - "Ref": "AWS::Partition" + "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 }, - ":states:::lambda:invoke\\",\\"Parameters\\":{\\"FunctionName\\":\\"", { - "Fn::GetAtt": [ - "HelloHandler2E4FBA4D", - "Arn" - ] + "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 }, - "\\",\\"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" + "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 }, - ":states:::lambda:invoke\\",\\"Parameters\\":{\\"FunctionName\\":\\"", { - "Fn::GetAtt": [ - "HelloHandler2E4FBA4D", - "Arn" - ] + "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 }, - "\\",\\"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" + "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 }, - ":states:::lambda:invoke\\",\\"Parameters\\":{\\"FunctionName\\":\\"", { - "Fn::GetAtt": [ - "HelloHandler2E4FBA4D", - "Arn" - ] + "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 }, - "\\",\\"Payload.$\\":\\"$\\"}}},\\"TimeoutSeconds\\":300}" + { + "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 + } ] - ] + } } }, - "DependsOn": [ - "StateMachineRoleDefaultPolicyDF1E6607", - "StateMachineRoleB840431D" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete", - "Metadata": { - "aws:cdk:path": "CdkSFNStackTest-Europe/StateMachine/Resource" - } + "Type": "AWS::CloudWatch::Dashboard" }, - "CDKMetadata": { - "Type": "AWS::CDK::Metadata", + "slicWatchLambdaDurationAlarmHelloHandler2E4FBA4D": { "Properties": { - "Analytics": "v2:deflate64:H4sIAAAAAAAA/11P0UoDQQz8lr7nolaQvtpCoaAgp+Djke6lbbp7u6XZq8iy/+7etoIIgZnJhEwyx8UT3s/oSxvT28bJFtN7JGOhtLqkXjF9hJMYWO18JRkcDdueMK1Hb6IEP1m/PIPQgKkNjqd2xbfgxHxP8soy6GNHqhwVnycoGpejsRyXpAwa+bS77dMuklrFl5q58Zdg/w1g+iSJsCZxsDoEMQzlgcivZA7i6xV/dc7QsobxXOZqeDH34vf12puRwYee8ah3l4cFlprPjirSnEcfZWBsr/gDsE52pTwBAAA=" + "ActionsEnabled": true, + "AlarmActions": [], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${HelloHandler2E4FBA4D} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" }, - "Metadata": { - "aws:cdk:path": "CdkSFNStackTest-Europe/CDKMetadata/Default" - } + "Type": "AWS::CloudWatch::Alarm" }, "slicWatchLambdaErrorsAlarmHelloHandler2E4FBA4D": { - "Type": "AWS::CloudWatch::Alarm", "Properties": { "ActionsEnabled": true, "AlarmActions": [], - "OKActions": [], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${HelloHandler2E4FBA4D} breaches 0", + {} + ] + }, "AlarmName": { "Fn::Sub": [ "Lambda_Errors_\${HelloHandler2E4FBA4D}", {} ] }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "HelloHandler2E4FBA4D" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmHelloHandler2E4FBA4D": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], "AlarmDescription": { "Fn::Sub": [ - "Error count for \${HelloHandler2E4FBA4D} breaches 0", + "Total invocations for \${HelloHandler2E4FBA4D} breaches 4", {} ] }, - "MetricName": "Errors", - "Namespace": "AWS/Lambda", + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${HelloHandler2E4FBA4D}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { "Name": "FunctionName", @@ -8537,32 +8741,35 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP } } ], - "Statistic": "Sum", - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 4, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, "slicWatchLambdaThrottlesAlarmHelloHandler2E4FBA4D": { - "Type": "AWS::CloudWatch::Alarm", "Properties": { "ActionsEnabled": true, "AlarmActions": [], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Throttles_\${HelloHandler2E4FBA4D}", + "Throttles % for \${HelloHandler2E4FBA4D} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Throttles % for \${HelloHandler2E4FBA4D} breaches 0", + "Lambda_Throttles_\${HelloHandler2E4FBA4D}", {} ] }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, "Metrics": [ { "Id": "throttles_pc", @@ -8611,200 +8818,68 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP "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 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchStatesExecutionsFailedAlarmStateMachine2E01A3A5": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchSNSNumberOfNotificationsFailedAlarmMyTopic86869434": { "Properties": { - "ActionsEnabled": true, - "AlarmActions": [], - "OKActions": [], - "MetricName": "ExecutionsFailed", - "Namespace": "AWS/States", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "StateMachine2E01A3A5" - } - } - ], - "AlarmName": { + "ActionsEnabled": true, + "AlarmActions": [], + "AlarmDescription": { "Fn::Sub": [ - "StepFunctions_ExecutionsFailedAlarm_\${StateMachine2E01A3A5.Name}", + "SNS NumberOfNotificationsFailed for \${MyTopic86869434.TopicName} breaches 1", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "StepFunctions ExecutionsFailed Sum for \${StateMachine2E01A3A5.Name} breaches 0", + "SNS_NumberOfNotificationsFailed_Alarm_\${MyTopic86869434.TopicName}", {} ] }, - "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", + "Name": "TopicName", "Value": { - "Ref": "StateMachine2E01A3A5" + "Fn::GetAtt": [ + "MyTopic86869434", + "TopicName" + ] } } ], - "AlarmName": { + "EvaluationPeriods": 1, + "MetricName": "NumberOfNotificationsFailed", + "Namespace": "AWS/SNS", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchSNSNumberOfNotificationsFilteredOutInvalidAttributesAlarmMyTopic86869434": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "AlarmDescription": { "Fn::Sub": [ - "StepFunctions_ExecutionsTimedOutAlarm_\${StateMachine2E01A3A5.Name}", + "SNS NumberOfNotificationsFilteredOutInvalidAttributes for \${MyTopic86869434.TopicName} breaches 1", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "StepFunctions ExecutionsTimedOut Sum for \${StateMachine2E01A3A5.Name} breaches 0", + "SNS_NumberOfNotificationsFilteredOutInvalidAttributes_Alarm_\${MyTopic86869434.TopicName}", {} ] }, - "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", @@ -8816,326 +8891,250 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP } } ], - "AlarmName": { + "EvaluationPeriods": 1, + "MetricName": "NumberOfNotificationsFilteredOut-InvalidAttributes", + "Namespace": "AWS/SNS", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchStatesExecutionsFailedAlarmStateMachine2E01A3A5": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "AlarmDescription": { "Fn::Sub": [ - "SNS_NumberOfNotificationsFilteredOutInvalidAttributes_Alarm_\${MyTopic86869434.TopicName}", + "StepFunctions ExecutionsFailed Sum for \${StateMachine2E01A3A5.Name} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "SNS NumberOfNotificationsFilteredOutInvalidAttributes for \${MyTopic86869434.TopicName} breaches 1", + "StepFunctions_ExecutionsFailedAlarm_\${StateMachine2E01A3A5.Name}", {} ] }, - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "StateMachine2E01A3A5" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 1 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchSNSNumberOfNotificationsFailedAlarmMyTopic86869434": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchStatesExecutionsTimedOutAlarmStateMachine2E01A3A5": { "Properties": { "ActionsEnabled": true, "AlarmActions": [], - "OKActions": [], - "MetricName": "NumberOfNotificationsFailed", - "Namespace": "AWS/SNS", + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionsTimedOut Sum for \${StateMachine2E01A3A5.Name} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionsTimedOutAlarm_\${StateMachine2E01A3A5.Name}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "TopicName", + "Name": "StateMachineArn", "Value": { - "Fn::GetAtt": [ - "MyTopic86869434", - "TopicName" - ] + "Ref": "StateMachine2E01A3A5" } } ], - "AlarmName": { + "EvaluationPeriods": 1, + "MetricName": "ExecutionsTimedOut", + "Namespace": "AWS/States", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchStatesExecutionThrottledAlarmStateMachine2E01A3A5": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [], + "AlarmDescription": { "Fn::Sub": [ - "SNS_NumberOfNotificationsFailed_Alarm_\${MyTopic86869434.TopicName}", + "StepFunctions ExecutionThrottled Sum for \${StateMachine2E01A3A5.Name} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "SNS NumberOfNotificationsFailed for \${MyTopic86869434.TopicName} breaches 1", + "StepFunctions_ExecutionThrottledAlarm_\${StateMachine2E01A3A5.Name}", {} ] }, - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "StateMachine2E01A3A5" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "OKActions": [], + "Period": 60, "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 - }, + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "StateMachine2E01A3A5": { + "DeletionPolicy": "Delete", + "DependsOn": [ + "StateMachineRoleDefaultPolicyDF1E6607", + "StateMachineRoleB840431D" + ], + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/StateMachine/Resource" + }, + "Properties": { + "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:", { - "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 + "Ref": "AWS::Partition" }, + ":states:::lambda:invoke\\",\\"Parameters\\":{\\"FunctionName\\":\\"", { - "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 + "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:", { - "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 + "Ref": "AWS::Partition" }, + ":states:::lambda:invoke\\",\\"Parameters\\":{\\"FunctionName\\":\\"", { - "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 + "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:", { - "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 + "Ref": "AWS::Partition" }, + ":states:::lambda:invoke\\",\\"Parameters\\":{\\"FunctionName\\":\\"", { - "type": "metric", - "properties": { - "metrics": [ - [ - "AWS/SNS", - "NumberOfNotificationsFilteredOut-InvalidAttributes", - "TopicName", - "\${MyTopic86869434.TopicName}", - { - "stat": "Sum" - } - ], + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + "\\",\\"Payload.$\\":\\"$\\"}}},\\"TimeoutSeconds\\":300}" + ] + ] + }, + "RoleArn": { + "Fn::GetAtt": [ + "StateMachineRoleB840431D", + "Arn" + ] + } + }, + "Type": "AWS::StepFunctions::StateMachine", + "UpdateReplacePolicy": "Delete" + }, + "StateMachineRoleB840431D": { + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/StateMachine/Role/Resource" + }, + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.eu-west-1.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + }, + "Type": "AWS::IAM::Role" + }, + "StateMachineRoleDefaultPolicyDF1E6607": { + "Metadata": { + "aws:cdk:path": "CdkSFNStackTest-Europe/StateMachine/Role/DefaultPolicy/Resource" + }, + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + { + "Fn::Join": [ + "", [ - "AWS/SNS", - "NumberOfNotificationsFailed", - "TopicName", - "\${MyTopic86869434.TopicName}", { - "stat": "Sum" - } + "Fn::GetAtt": [ + "HelloHandler2E4FBA4D", + "Arn" + ] + }, + ":*" ] - ], - "title": "SNS Topic \${MyTopic86869434.TopicName}", - "view": "timeSeries", - "region": "\${AWS::Region}", - "period": 300 - }, - "width": 8, - "height": 6, - "x": 16, - "y": 12 - } - ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "StateMachineRoleDefaultPolicyDF1E6607", + "Roles": [ + { + "Ref": "StateMachineRoleB840431D" } - } - } - } - }, - "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]" + ] + }, + "Type": "AWS::IAM::Policy" } }, "Rules": { @@ -9164,6 +9163,7 @@ exports[`cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts > TAP } ] } - } + }, + "Transform": "SlicWatch-v3" } ` 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 index 640908fa..89cc3e3d 100644 --- 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 @@ -11,8 +11,8 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Description": "sam-test-project", "Metadata": { "slicWatch": { - "enabled": true, "alarmActionsConfig": { + "actionsEnabled": true, "alarmActions": [ { "Ref": "MonitoringTopic" @@ -22,8 +22,7 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP { "Ref": "MonitoringTopic" } - ], - "actionsEnabled": true + ] }, "alarms": { "Lambda": { @@ -34,8 +33,8 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP }, "SQS": { "AgeOfOldestMessage": { - "Statistic": "Maximum", "enabled": true, + "Statistic": "Maximum", "Threshold": 60 }, "InFlightMessagesPc": { @@ -43,145 +42,17 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Threshold": 1 } } - } + }, + "enabled": true } }, "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", + "Metadata": { + "SamResourceId": "dataTable" + }, "Properties": { - "ProvisionedThroughput": { - "ReadCapacityUnits": 1, - "WriteCapacityUnits": 1 - }, "AttributeDefinitions": [ { "AttributeName": "pk", @@ -204,16 +75,6 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "AttributeType": "N" } ], - "KeySchema": [ - { - "AttributeName": "pk", - "KeyType": "HASH" - }, - { - "AttributeName": "sk", - "KeyType": "RANGE" - } - ], "GlobalSecondaryIndexes": [ { "IndexName": "GSI1", @@ -239,6 +100,16 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP } } ], + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "sk", + "KeyType": "RANGE" + } + ], "LocalSecondaryIndexes": [ { "IndexName": "LSI1", @@ -259,25 +130,17 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "ProjectionType": "INCLUDE" } } - ] + ], + "ProvisionedThroughput": { + "ReadCapacityUnits": 1, + "WriteCapacityUnits": 1 + } }, - "Metadata": { - "SamResourceId": "dataTable" - } + "Type": "AWS::DynamoDB::Table" }, - "hello": { - "Type": "AWS::Lambda::Function", + "driveQueue": { "Metadata": { - "SamResourceId": "hello", - "slicWatch": { - "alarms": { - "Lambda": { - "Invocations": { - "Threshold": 2 - } - } - } - } + "SamResourceId": "driveQueue" }, "Properties": { "Code": { @@ -287,7 +150,7 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Handler": "basic-handler.hello", "Role": { "Fn::GetAtt": [ - "helloRole", + "driveQueueRole", "Arn" ] }, @@ -298,13 +161,12 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Value": "SAM" } ] - } + }, + "Type": "AWS::Lambda::Function" }, - "helloRole": { - "Type": "AWS::IAM::Role", + "driveQueueRole": { "Properties": { "AssumeRolePolicyDocument": { - "Version": "2012-10-17", "Statement": [ { "Action": [ @@ -317,7 +179,8 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP ] } } - ] + ], + "Version": "2012-10-17" }, "ManagedPolicyArns": [ "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" @@ -328,27 +191,22 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Value": "SAM" } ] - } + }, + "Type": "AWS::IAM::Role" }, - "ping": { - "Type": "AWS::Lambda::Function", + "driveStream": { "Metadata": { - "SamResourceId": "ping", - "slicWatch": { - "dashboard": { - "enabled": false - } - } + "SamResourceId": "driveStream" }, "Properties": { "Code": { "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" }, - "Handler": "basic-handler.hello", + "Handler": "stream-test-handler.handleDrive", "Role": { "Fn::GetAtt": [ - "pingRole", + "driveStreamRole", "Arn" ] }, @@ -359,13 +217,12 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Value": "SAM" } ] - } + }, + "Type": "AWS::Lambda::Function" }, - "pingRole": { - "Type": "AWS::IAM::Role", + "driveStreamRole": { "Properties": { "AssumeRolePolicyDocument": { - "Version": "2012-10-17", "Statement": [ { "Action": [ @@ -378,7 +235,8 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP ] } } - ] + ], + "Version": "2012-10-17" }, "ManagedPolicyArns": [ "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" @@ -389,12 +247,12 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Value": "SAM" } ] - } + }, + "Type": "AWS::IAM::Role" }, - "throttler": { - "Type": "AWS::Lambda::Function", + "driveTable": { "Metadata": { - "SamResourceId": "throttler" + "SamResourceId": "driveTable" }, "Properties": { "Code": { @@ -404,7 +262,7 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Handler": "basic-handler.hello", "Role": { "Fn::GetAtt": [ - "throttlerRole", + "driveTableRole", "Arn" ] }, @@ -414,15 +272,13 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Key": "lambda:createdBy", "Value": "SAM" } - ], - "ReservedConcurrentExecutions": 0 - } + ] + }, + "Type": "AWS::Lambda::Function" }, - "throttlerRole": { - "Type": "AWS::IAM::Role", + "driveTableRole": { "Properties": { "AssumeRolePolicyDocument": { - "Version": "2012-10-17", "Statement": [ { "Action": [ @@ -435,7 +291,8 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP ] } } - ] + ], + "Version": "2012-10-17" }, "ManagedPolicyArns": [ "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" @@ -446,22 +303,62 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Value": "SAM" } ] - } + }, + "Type": "AWS::IAM::Role" }, - "driveStream": { - "Type": "AWS::Lambda::Function", + "ecsCluster": { "Metadata": { - "SamResourceId": "driveStream" + "SamResourceId": "ecsCluster" + }, + "Type": "AWS::ECS::Cluster" + }, + "ecsService": { + "Metadata": { + "SamResourceId": "ecsService" + }, + "Properties": { + "Cluster": { + "Ref": "ecsCluster" + }, + "DesiredCount": 0, + "LaunchType": "FARGATE", + "NetworkConfiguration": { + "AwsvpcConfiguration": { + "AssignPublicIp": "ENABLED", + "SecurityGroups": [], + "Subnets": [ + { + "Ref": "subnet" + } + ] + } + }, + "TaskDefinition": { + "Ref": "taskDef" + } + }, + "Type": "AWS::ECS::Service" + }, + "eventsRule": { + "Metadata": { + "SamResourceId": "eventsRule", + "slicWatch": { + "alarms": { + "Lambda": { + "enabled": false + } + } + } }, "Properties": { "Code": { "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" }, - "Handler": "stream-test-handler.handleDrive", + "Handler": "rule-handler.handleRule", "Role": { "Fn::GetAtt": [ - "driveStreamRole", + "eventsRuleRole", "Arn" ] }, @@ -472,13 +369,12 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Value": "SAM" } ] - } + }, + "Type": "AWS::Lambda::Function" }, - "driveStreamRole": { - "Type": "AWS::IAM::Role", + "eventsRuleRole": { "Properties": { "AssumeRolePolicyDocument": { - "Version": "2012-10-17", "Statement": [ { "Action": [ @@ -491,7 +387,8 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP ] } } - ] + ], + "Version": "2012-10-17" }, "ManagedPolicyArns": [ "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" @@ -502,124 +399,71 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Value": "SAM" } ] - } - }, - "driveQueue": { - "Type": "AWS::Lambda::Function", - "Metadata": { - "SamResourceId": "driveQueue" }, + "Type": "AWS::IAM::Role" + }, + "eventsRuleTrigger": { "Properties": { - "Code": { - "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", - "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" - }, - "Handler": "basic-handler.hello", - "Role": { - "Fn::GetAtt": [ - "driveQueueRole", - "Arn" + "EventPattern": { + "detail-type": [ + "Invoke Lambda Function" ] }, - "Runtime": "nodejs18.x", - "Tags": [ + "Targets": [ { - "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" - ] - } + "Arn": { + "Fn::GetAtt": [ + "eventsRule", + "Arn" + ] + }, + "Id": "eventsRuleTriggerLambdaTarget", + "RetryPolicy": { + "MaximumRetryAttempts": 0, + "MaximumEventAgeInSeconds": 60 } - ] - }, - "ManagedPolicyArns": [ - "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ], - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" } ] - } - }, - "driveTable": { - "Type": "AWS::Lambda::Function", - "Metadata": { - "SamResourceId": "driveTable" }, + "Type": "AWS::Events::Rule" + }, + "eventsRuleTriggerPermission": { "Properties": { - "Code": { - "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", - "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Ref": "eventsRule" }, - "Handler": "basic-handler.hello", - "Role": { + "Principal": "events.amazonaws.com", + "SourceArn": { "Fn::GetAtt": [ - "driveTableRole", + "eventsRuleTrigger", "Arn" ] - }, - "Runtime": "nodejs18.x", - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ] - } + } + }, + "Type": "AWS::Lambda::Permission" }, - "driveTableRole": { - "Type": "AWS::IAM::Role", + "fifoQueue": { + "Metadata": { + "SamResourceId": "fifoQueue" + }, "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Action": [ - "sts:AssumeRole" - ], - "Effect": "Allow", - "Principal": { - "Service": [ - "lambda.amazonaws.com" - ] + "FifoQueue": true + }, + "Type": "AWS::SQS::Queue" + }, + "hello": { + "Metadata": { + "SamResourceId": "hello", + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 2 } } - ] - }, - "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": { @@ -629,7 +473,7 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Handler": "basic-handler.hello", "Role": { "Fn::GetAtt": [ - "streamProcessorRole", + "helloRole", "Arn" ] }, @@ -640,13 +484,12 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Value": "SAM" } ] - } + }, + "Type": "AWS::Lambda::Function" }, - "streamProcessorRole": { - "Type": "AWS::IAM::Role", + "helloRole": { "Properties": { "AssumeRolePolicyDocument": { - "Version": "2012-10-17", "Statement": [ { "Action": [ @@ -659,11 +502,11 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP ] } } - ] + ], + "Version": "2012-10-17" }, "ManagedPolicyArns": [ - "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "arn:aws:iam::aws:policy/service-role/AWSLambdaKinesisExecutionRole" + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ], "Tags": [ { @@ -671,26 +514,10 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Value": "SAM" } ] - } - }, - "streamProcessorStream": { - "Type": "AWS::Lambda::EventSourceMapping", - "Properties": { - "EventSourceArn": { - "Fn::GetAtt": [ - "stream", - "Arn" - ] - }, - "FunctionName": { - "Ref": "streamProcessor" - }, - "MaximumRetryAttempts": 0, - "StartingPosition": "LATEST" - } + }, + "Type": "AWS::IAM::Role" }, "httpGetter": { - "Type": "AWS::Lambda::Function", "Metadata": { "SamResourceId": "httpGetter" }, @@ -707,20 +534,40 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP ] }, "Runtime": "nodejs18.x", - "Timeout": 30, "Tags": [ { "Key": "lambda:createdBy", "Value": "SAM" } - ] - } + ], + "Timeout": 30 + }, + "Type": "AWS::Lambda::Function" + }, + "httpGetterHttpApiEventPermission": { + "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__": "*" + } + ] + } + }, + "Type": "AWS::Lambda::Permission" }, "httpGetterRole": { - "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { - "Version": "2012-10-17", "Statement": [ { "Action": [ @@ -733,7 +580,8 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP ] } } - ] + ], + "Version": "2012-10-17" }, "ManagedPolicyArns": [ "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" @@ -744,38 +592,24 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Value": "SAM" } ] - } + }, + "Type": "AWS::IAM::Role" }, - "httpGetterHttpApiEventPermission": { - "Type": "AWS::Lambda::Permission", + "MonitoringTopic": { + "Metadata": { + "SamResourceId": "MonitoringTopic" + }, "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__": "*" - } - ] - } - } + "TopicName": "SS-Alarm-Topic3" + }, + "Type": "AWS::SNS::Topic" }, - "eventsRule": { - "Type": "AWS::Lambda::Function", + "ping": { "Metadata": { - "SamResourceId": "eventsRule", + "SamResourceId": "ping", "slicWatch": { - "alarms": { - "Lambda": { - "enabled": false - } + "dashboard": { + "enabled": false } } }, @@ -784,10 +618,10 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" }, - "Handler": "rule-handler.handleRule", + "Handler": "basic-handler.hello", "Role": { "Fn::GetAtt": [ - "eventsRuleRole", + "pingRole", "Arn" ] }, @@ -798,13 +632,12 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "Value": "SAM" } ] - } + }, + "Type": "AWS::Lambda::Function" }, - "eventsRuleRole": { - "Type": "AWS::IAM::Role", + "pingRole": { "Properties": { "AssumeRolePolicyDocument": { - "Version": "2012-10-17", "Statement": [ { "Action": [ @@ -817,7 +650,8 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP ] } } - ] + ], + "Version": "2012-10-17" }, "ManagedPolicyArns": [ "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" @@ -828,189 +662,40 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "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" - ] - } - } + }, + "Type": "AWS::IAM::Role" }, - "TestStateMachine": { - "Type": "AWS::StepFunctions::StateMachine", + "regularQueue": { "Metadata": { - "SamResourceId": "TestStateMachine" + "SamResourceId": "regularQueue" }, - "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", + "Type": "AWS::SQS::Queue" + }, + "ServerlessHttpApi": { "Properties": { "Body": { "info": { - "version": "1.0", "title": { "Ref": "AWS::StackName" - } + }, + "version": "1.0" }, + "openapi": "3.0.1", "paths": { "item": { "get": { + "responses": {}, "x-amazon-apigateway-integration": { "httpMethod": "POST", + "payloadFormatVersion": "2.0", "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", @@ -1018,2945 +703,852 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP } ] } - } + }, + "Type": "AWS::ApiGatewayV2::Api" }, "ServerlessHttpApiApiGatewayDefaultStage": { - "Type": "AWS::ApiGatewayV2::Stage", "Properties": { "ApiId": { "Ref": "ServerlessHttpApi" }, + "AutoDeploy": true, "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 - } + } + }, + "Type": "AWS::ApiGatewayV2::Stage" }, - "slicWatchLambdaThrottlesAlarmhello": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchDashboard": { "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" - } - } - ] + "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 }, - "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" - } - } - ] + { + "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 }, - "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" - } - } - ] + { + "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 }, - "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" - } - } - ] + { + "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 }, - "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" - } - } - ] + { + "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 }, - "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" - } - } - ] + { + "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 }, - "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" - } - } - ] + { + "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 }, - "Period": 60, - "Stat": "Sum" - }, - "ReturnData": false - }, - { - "Id": "invocations", - "MetricStat": { - "Metric": { - "Namespace": "AWS/Lambda", - "MetricName": "Invocations", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "streamProcessor" - } - } - ] + { + "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 }, - "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" - } - } - ] + { + "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 }, - "Period": 60, - "Stat": "Sum" - }, - "ReturnData": false - }, - { - "Id": "invocations", - "MetricStat": { - "Metric": { - "Namespace": "AWS/Lambda", - "MetricName": "Invocations", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "httpGetter" - } - } - ] + { + "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 }, - "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}", + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${hello}", { - "stat": "Sum" + "stat": "Maximum" } ], [ - "AWS/States", - "ExecutionThrottled", - "StateMachineArn", - "\${TestStateMachine}", + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${throttler}", { - "stat": "Sum" + "stat": "Maximum" } ], [ - "AWS/States", - "ExecutionsTimedOut", - "StateMachineArn", - "\${TestStateMachine}", + "AWS/Lambda", + "ConcurrentExecutions", + "FunctionName", + "\${driveStream}", { - "stat": "Sum" + "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": "\${TestStateMachine.Name} Step Function Executions", + "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 @@ -3964,23 +1556,23 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "width": 8, "height": 6, "x": 0, - "y": 0 + "y": 24 }, { "type": "metric", "properties": { "metrics": [ [ - "AWS/DynamoDB", - "ReadThrottleEvents", - "TableName", - "\${dataTable}", + "AWS/Kinesis", + "GetRecords.IteratorAgeMilliseconds", + "StreamName", + "\${stream}", { - "stat": "Sum" + "stat": "Maximum" } ] ], - "title": "ReadThrottleEvents Table \${dataTable}", + "title": "IteratorAge \${stream} Kinesis", "view": "timeSeries", "region": "\${AWS::Region}", "period": 300 @@ -3988,34 +1580,140 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "width": 8, "height": 6, "x": 8, - "y": 0 + "y": 24 }, { "type": "metric", "properties": { "metrics": [ [ - "AWS/DynamoDB", - "ReadThrottleEvents", - "TableName", - "\${dataTable}", + "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/DynamoDB", - "ReadThrottleEvents", - "TableName", - "\${dataTable}", - "GlobalSecondaryIndex", - "GSI1", + "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": "Sum" + "stat": "Maximum" } ] ], - "title": "ReadThrottleEvents GSI GSI1 in \${dataTable}", + "title": "Oldest Message age \${regularQueue.QueueName} SQS", "view": "timeSeries", "region": "\${AWS::Region}", "period": 300 @@ -4023,43 +1721,23 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "width": 8, "height": 6, "x": 16, - "y": 0 + "y": 30 }, { "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}", + "AWS/SQS", + "ApproximateNumberOfMessagesVisible", + "QueueName", + "\${regularQueue.QueueName}", { - "stat": "Sum" + "stat": "Maximum" } ] ], - "title": "WriteThrottleEvents Table \${dataTable}", + "title": "Messages in queue \${regularQueue.QueueName} SQS", "view": "timeSeries", "region": "\${AWS::Region}", "period": 300 @@ -4067,54 +1745,41 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "width": 8, "height": 6, "x": 0, - "y": 6 + "y": 36 }, { "type": "metric", "properties": { "metrics": [ [ - "AWS/DynamoDB", - "ReadThrottleEvents", - "TableName", - "\${dataTable}", - { - "stat": "Sum" - } - ], - [ - "AWS/DynamoDB", - "ReadThrottleEvents", - "TableName", - "\${dataTable}", - "GlobalSecondaryIndex", - "GSI1", + "AWS/SQS", + "NumberOfMessagesSent", + "QueueName", + "\${fifoQueue.QueueName}", { "stat": "Sum" } ], [ - "AWS/DynamoDB", - "WriteThrottleEvents", - "TableName", - "\${dataTable}", + "AWS/SQS", + "NumberOfMessagesReceived", + "QueueName", + "\${fifoQueue.QueueName}", { "stat": "Sum" } ], [ - "AWS/DynamoDB", - "WriteThrottleEvents", - "TableName", - "\${dataTable}", - "GlobalSecondaryIndex", - "GSI1", + "AWS/SQS", + "NumberOfMessagesDeleted", + "QueueName", + "\${fifoQueue.QueueName}", { "stat": "Sum" } ] ], - "title": "WriteThrottleEvents GSI GSI1 in \${dataTable}", + "title": "Messages \${fifoQueue.QueueName} SQS", "view": "timeSeries", "region": "\${AWS::Region}", "period": 300 @@ -4122,86 +1787,23 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "width": 8, "height": 6, "x": 8, - "y": 6 + "y": 36 }, { "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}", + "AWS/SQS", + "ApproximateAgeOfOldestMessage", + "QueueName", + "\${fifoQueue.QueueName}", { - "stat": "Sum" + "stat": "Maximum" } ] ], - "title": "Lambda Errors Sum per Function", + "title": "Oldest Message age \${fifoQueue.QueueName} SQS", "view": "timeSeries", "region": "\${AWS::Region}", "period": 300 @@ -4209,949 +1811,3347 @@ exports[`sam-test-project/tests/snapshot/sam-test-project-snapshot.test.ts > TAP "width": 8, "height": 6, "x": 16, - "y": 6 + "y": 36 }, { "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}", + "AWS/SQS", + "ApproximateNumberOfMessagesVisible", + "QueueName", + "\${fifoQueue.QueueName}", { - "stat": "Sum" + "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/Lambda", - "Throttles", - "FunctionName", - "\${httpGetter}", + "AWS/ECS", + "MemoryUtilization", + "ServiceName", + "\${ecsService.Name}", + "ClusterName", + "\${ecsCluster}", { - "stat": "Sum" + "stat": "Average" } ], [ - "AWS/Lambda", - "Throttles", - "FunctionName", - "\${eventsRule}", + "AWS/ECS", + "CPUUtilization", + "ServiceName", + "\${ecsService.Name}", + "ClusterName", + "\${ecsCluster}", { - "stat": "Sum" + "stat": "Average" } ] ], - "title": "Lambda Throttles Sum per Function", + "title": "ECS Service \${ecsService.Name}", "view": "timeSeries", "region": "\${AWS::Region}", "period": 300 }, "width": 8, "height": 6, - "x": 0, - "y": 12 + "x": 8, + "y": 42 }, { "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}", + "AWS/SNS", + "NumberOfNotificationsFilteredOut-InvalidAttributes", + "TopicName", + "\${MonitoringTopic.TopicName}", { - "stat": "Average" + "stat": "Sum" } ], [ - "AWS/Lambda", - "Duration", - "FunctionName", - "\${driveTable}", + "AWS/SNS", + "NumberOfNotificationsFailed", + "TopicName", + "\${MonitoringTopic.TopicName}", { - "stat": "Average" + "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/Lambda", - "Duration", - "FunctionName", - "\${streamProcessor}", + "AWS/Events", + "FailedInvocations", + "RuleName", + "\${eventsRuleTrigger}", { - "stat": "Average" + "stat": "Sum" } ], [ - "AWS/Lambda", - "Duration", - "FunctionName", - "\${httpGetter}", + "AWS/Events", + "ThrottledRules", + "RuleName", + "\${eventsRuleTrigger}", { - "stat": "Average" + "stat": "Sum" } ], [ - "AWS/Lambda", - "Duration", - "FunctionName", - "\${eventsRule}", + "AWS/Events", + "Invocations", + "RuleName", + "\${eventsRuleTrigger}", { - "stat": "Average" + "stat": "Sum" } ] ], - "title": "Lambda Duration Average per Function", + "title": "EventBridge Rule \${eventsRuleTrigger}", "view": "timeSeries", "region": "\${AWS::Region}", "period": 300 }, "width": 8, "height": 6, - "x": 8, - "y": 12 + "x": 0, + "y": 48 + } + ] + } + } + }, + "Type": "AWS::CloudWatch::Dashboard" + }, + "slicWatchECSCPUAlarmecsService": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "ECS CPUUtilization for \${ecsService.Name} breaches 90", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "ECS_CPUAlarm_\${ecsService.Name}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "ServiceName", + "Value": { + "Fn::GetAtt": [ + "ecsService", + "Name" + ] + } + }, + { + "Name": "ClusterName", + "Value": { + "Ref": "ecsCluster" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "CPUUtilization", + "Namespace": "AWS/ECS", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Average", + "Threshold": 90, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchECSMemoryAlarmecsService": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "ECS MemoryUtilization for \${ecsService.Name} breaches 90", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "ECS_MemoryAlarm_\${ecsService.Name}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "ServiceName", + "Value": { + "Fn::GetAtt": [ + "ecsService", + "Name" + ] + } + }, + { + "Name": "ClusterName", + "Value": { + "Ref": "ecsCluster" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "MemoryUtilization", + "Namespace": "AWS/ECS", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Average", + "Threshold": 90, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchEventsFailedInvocationsAlarmEventsRuleTrigger": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge FailedInvocations for \${eventsRuleTrigger} breaches 1", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Events_FailedInvocations_Alarm_\${eventsRuleTrigger}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "eventsRuleTrigger" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "FailedInvocations", + "Namespace": "AWS/Events", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchEventsThrottledRulesAlarmEventsRuleTrigger": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "EventBridge ThrottledRules for \${eventsRuleTrigger} breaches 1", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Events_ThrottledRules_Alarm_\${eventsRuleTrigger}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "RuleName", + "Value": { + "Ref": "eventsRuleTrigger" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ThrottledRules", + "Namespace": "AWS/Events", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchGSIReadThrottleEventsAlarmdataTableGSI1": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable}GSI1 breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "DDB_ReadThrottleEvents_Alarm_\${dataTable}GSI1", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + }, + { + "Name": "GlobalSecondaryIndex", + "Value": "GSI1" + } + ], + "EvaluationPeriods": 1, + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchGSIWriteThrottleEventsAlarmdataTableGSI1": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable}GSI1 breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "DDB_WriteThrottleEvents_Alarm_\${dataTable}GSI1", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + }, + { + "Name": "GlobalSecondaryIndex", + "Value": "GSI1" + } + ], + "EvaluationPeriods": 1, + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchKinesisStreamGetRecordsSuccessAlarmStream": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Average GetRecords.Success for \${stream} breaches 1 milliseconds", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamGetRecordsSuccess_\${stream}", + {} + ] + }, + "ComparisonOperator": "LessThanThreshold", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "GetRecords.Success", + "Namespace": "AWS/Kinesis", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Average", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchKinesisStreamIteratorAgeAlarmStream": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Maximum GetRecords.IteratorAgeMilliseconds for \${stream} breaches 10000 milliseconds", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamIteratorAge_\${stream}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "GetRecords.IteratorAgeMilliseconds", + "Namespace": "AWS/Kinesis", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 10000, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchKinesisStreamPutRecordsSuccessAlarmStream": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Average PutRecords.Success for \${stream} breaches 1 milliseconds", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamPutRecordsSuccess_\${stream}", + {} + ] + }, + "ComparisonOperator": "LessThanThreshold", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "PutRecords.Success", + "Namespace": "AWS/Kinesis", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Average", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchKinesisStreamPutRecordSuccessAlarmStream": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Average PutRecord.Success for \${stream} breaches 1 milliseconds", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamPutRecordSuccess_\${stream}", + {} + ] + }, + "ComparisonOperator": "LessThanThreshold", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "PutRecord.Success", + "Namespace": "AWS/Kinesis", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Average", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchKinesisStreamReadThroughputAlarmStream": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Sum ReadProvisionedThroughputExceeded for \${stream} breaches 0 milliseconds", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamReadThroughput_\${stream}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ReadProvisionedThroughputExceeded", + "Namespace": "AWS/Kinesis", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchKinesisStreamWriteThroughputAlarmStream": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Kinesis Sum WriteProvisionedThroughputExceeded for \${stream} breaches 0 milliseconds", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Kinesis_StreamWriteThroughput_\${stream}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "WriteProvisionedThroughputExceeded", + "Namespace": "AWS/Kinesis", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmdriveQueue": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${driveQueue} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${driveQueue}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveQueue" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmdriveStream": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${driveStream} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${driveStream}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveStream" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmdriveTable": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${driveTable} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${driveTable}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveTable" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmhello": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${hello} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${hello}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "hello" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmhttpGetter": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${httpGetter} breaches 95% of timeout (30)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${httpGetter}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "httpGetter" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 28500, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmping": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${ping} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${ping}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ping" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmstreamProcessor": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${streamProcessor} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${streamProcessor}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "streamProcessor" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaDurationAlarmthrottler": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Max duration for \${throttler} breaches 95% of timeout (3)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Duration_\${throttler}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "throttler" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 2850, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmdriveQueue": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${driveQueue} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${driveQueue}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveQueue" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmdriveStream": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${driveStream} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${driveStream}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveStream" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmdriveTable": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${driveTable} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${driveTable}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveTable" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmhello": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${hello} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${hello}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "hello" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmhttpGetter": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${httpGetter} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${httpGetter}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "httpGetter" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmping": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${ping} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${ping}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ping" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmstreamProcessor": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${streamProcessor} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${streamProcessor}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "streamProcessor" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaErrorsAlarmthrottler": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Error count for \${throttler} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Errors_\${throttler}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "throttler" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmdriveQueue": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${driveQueue} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${driveQueue}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveQueue" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmdriveStream": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${driveStream} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${driveStream}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveStream" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmdriveTable": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${driveTable} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${driveTable}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveTable" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmhello": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${hello} breaches 2", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${hello}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "hello" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 2, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmhttpGetter": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${httpGetter} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${httpGetter}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "httpGetter" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmping": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${ping} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${ping}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ping" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmstreamProcessor": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${streamProcessor} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${streamProcessor}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "streamProcessor" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaInvocationsAlarmthrottler": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Total invocations for \${throttler} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Invocations_\${throttler}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "throttler" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaIteratorAgeAlarmstreamProcessor": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "IteratorAge for \${streamProcessor} breaches 10000", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_IteratorAge_\${streamProcessor}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "streamProcessor" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "IteratorAge", + "Namespace": "AWS/Lambda", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 10000, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmdriveQueue": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${driveQueue} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${driveQueue}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveQueue" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmdriveStream": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${driveStream} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${driveStream}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveStream" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmdriveTable": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${driveTable} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${driveTable}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "driveTable" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmhello": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${hello} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${hello}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "hello" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmhttpGetter": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${httpGetter} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${httpGetter}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } + } + ] }, - { - "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 + "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 + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmping": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${ping} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${ping}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "ping" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmstreamProcessor": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${streamProcessor} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${streamProcessor}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "streamProcessor" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchLambdaThrottlesAlarmthrottler": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "Throttles % for \${throttler} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "Lambda_Throttles_\${throttler}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "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" + } + } + ] }, - { - "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 + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + }, + { + "Id": "invocations", + "MetricStat": { + "Metric": { + "Namespace": "AWS/Lambda", + "MetricName": "Invocations", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "throttler" + } + } + ] }, - { - "type": "metric", - "properties": { - "metrics": [ - [ - "AWS/ECS", - "MemoryUtilization", - "ServiceName", - "\${ecsService.Name}", - "ClusterName", - "\${ecsCluster}", - { - "stat": "Average" - } - ], - [ - "AWS/ECS", - "CPUUtilization", - "ServiceName", - "\${ecsService.Name}", - "ClusterName", - "\${ecsCluster}", - { - "stat": "Average" - } - ] + "Period": 60, + "Stat": "Sum" + }, + "ReturnData": false + } + ], + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchSNSNumberOfNotificationsFailedAlarmMonitoringTopic": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFailed for \${MonitoringTopic.TopicName} breaches 1", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFailed_Alarm_\${MonitoringTopic.TopicName}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "MonitoringTopic", + "TopicName" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "NumberOfNotificationsFailed", + "Namespace": "AWS/SNS", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchSNSNumberOfNotificationsFilteredOutInvalidAttributesAlarmMonitoringTopic": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "SNS NumberOfNotificationsFilteredOutInvalidAttributes for \${MonitoringTopic.TopicName} breaches 1", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "SNS_NumberOfNotificationsFilteredOutInvalidAttributes_Alarm_\${MonitoringTopic.TopicName}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TopicName", + "Value": { + "Fn::GetAtt": [ + "MonitoringTopic", + "TopicName" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "NumberOfNotificationsFilteredOut-InvalidAttributes", + "Namespace": "AWS/SNS", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchSQSInFlightMsgsAlarmfifoQueue": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "SQS in-flight messages for \${fifoQueue.QueueName} breaches 200 (1% of the hard limit of 20000)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateNumberOfMessagesNotVisible_\${fifoQueue.QueueName}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "fifoQueue", + "QueueName" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ApproximateNumberOfMessagesNotVisible", + "Namespace": "AWS/SQS", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 200, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchSQSInFlightMsgsAlarmregularQueue": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "SQS in-flight messages for \${regularQueue.QueueName} breaches 1200 (1% of the hard limit of 120000)", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateNumberOfMessagesNotVisible_\${regularQueue.QueueName}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "regularQueue", + "QueueName" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ApproximateNumberOfMessagesNotVisible", + "Namespace": "AWS/SQS", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 1200, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchSQSOldestMsgAgeAlarmfifoQueue": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "SQS age of oldest message in the queue \${fifoQueue.QueueName} breaches 60", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateAgeOfOldestMessage_\${fifoQueue.QueueName}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "fifoQueue", + "QueueName" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ApproximateAgeOfOldestMessage", + "Namespace": "AWS/SQS", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 60, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchSQSOldestMsgAgeAlarmregularQueue": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "SQS age of oldest message in the queue \${regularQueue.QueueName} breaches 60", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "SQS_ApproximateAgeOfOldestMessage_\${regularQueue.QueueName}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "regularQueue", + "QueueName" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ApproximateAgeOfOldestMessage", + "Namespace": "AWS/SQS", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 60, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchStatesExecutionsFailedAlarmTestStateMachine": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionsFailed Sum for \${TestStateMachine.Name} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionsFailedAlarm_\${TestStateMachine.Name}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "TestStateMachine" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchStatesExecutionsTimedOutAlarmTestStateMachine": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionsTimedOut Sum for \${TestStateMachine.Name} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionsTimedOutAlarm_\${TestStateMachine.Name}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "TestStateMachine" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsTimedOut", + "Namespace": "AWS/States", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchStatesExecutionThrottledAlarmTestStateMachine": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "StepFunctions ExecutionThrottled Sum for \${TestStateMachine.Name} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "StepFunctions_ExecutionThrottledAlarm_\${TestStateMachine.Name}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "TestStateMachine" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchTableReadThrottleEventsAlarmdataTable": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "DDB_ReadThrottleEvents_Alarm_\${dataTable}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchTableSystemErrorsAlarmdataTable": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "DDB_SystemErrors_Alarm_\${dataTable}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "SystemErrors", + "Namespace": "AWS/DynamoDB", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchTableUserErrorsAlarmdataTable": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable} breaches 0", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "DDB_UserErrors_Alarm_\${dataTable}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "UserErrors", + "Namespace": "AWS/DynamoDB", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchTableWriteThrottleEventsAlarmdataTable": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "AlarmDescription": { + "Fn::Sub": [ + "DynamoDB Sum for \${dataTable} breaches 10", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "DDB_WriteThrottleEvents_Alarm_\${dataTable}", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [ + { + "Ref": "MonitoringTopic" + } + ], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "stream": { + "Metadata": { + "SamResourceId": "stream" + }, + "Properties": { + "ShardCount": 1 + }, + "Type": "AWS::Kinesis::Stream" + }, + "streamProcessor": { + "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" + } + ] + }, + "Type": "AWS::Lambda::Function" + }, + "streamProcessorRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", + "arn:aws:iam::aws:policy/service-role/AWSLambdaKinesisExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::IAM::Role" + }, + "streamProcessorStream": { + "Properties": { + "EventSourceArn": { + "Fn::GetAtt": [ + "stream", + "Arn" + ] + }, + "FunctionName": { + "Ref": "streamProcessor" + }, + "MaximumRetryAttempts": 0, + "StartingPosition": "LATEST" + }, + "Type": "AWS::Lambda::EventSourceMapping" + }, + "subnet": { + "Metadata": { + "SamResourceId": "subnet" + }, + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": { + "Ref": "AWS::Region" + } + } + ] + }, + "CidrBlock": "10.0.16.0/20", + "VpcId": { + "Ref": "vpc" + } + }, + "Type": "AWS::EC2::Subnet" + }, + "taskDef": { + "Metadata": { + "SamResourceId": "taskDef" + }, + "Properties": { + "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 + } + ], + "Cpu": 256, + "Memory": 512, + "NetworkMode": "awsvpc", + "RequiresCompatibilities": [ + "FARGATE" + ] + }, + "Type": "AWS::ECS::TaskDefinition" + }, + "TestStateMachine": { + "Metadata": { + "SamResourceId": "TestStateMachine" + }, + "Properties": { + "DefinitionS3Location": { + "Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "Key": "sam-test-project/754f906d12f592f99c5651c04a6a0a51" + }, + "DefinitionSubstitutions": { + "AnotherHelloArn": { + "Fn::GetAtt": [ + "hello", + "Arn" + ] + }, + "HelloArn": { + "Fn::GetAtt": [ + "hello", + "Arn" + ] + } + }, + "RoleArn": { + "Fn::GetAtt": [ + "TestStateMachineRole", + "Arn" + ] + }, + "Tags": [ + { + "Key": "stateMachine:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::StepFunctions::StateMachine" + }, + "TestStateMachineRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "states.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [], + "Policies": [ + { + "PolicyName": "TestStateMachineRolePolicy0", + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "lambda:InvokeFunction" ], - "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}", + "Effect": "Allow", + "Resource": { + "Fn::Sub": [ + "arn:\${AWS::Partition}:lambda:\${AWS::Region}:\${AWS::AccountId}:function:\${functionName}*", { - "stat": "Sum" + "functionName": { + "Ref": "hello" + } } ] + } + } + ] + } + }, + { + "PolicyName": "TestStateMachineRolePolicy1", + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "lambda:InvokeFunction" ], - "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}", + "Effect": "Allow", + "Resource": { + "Fn::Sub": [ + "arn:\${AWS::Partition}:lambda:\${AWS::Region}:\${AWS::AccountId}:function:\${functionName}*", { - "stat": "Sum" + "functionName": { + "Ref": "hello" + } } ] - ], - "title": "EventBridge Rule \${eventsRuleTrigger}", - "view": "timeSeries", - "region": "\${AWS::Region}", - "period": 300 - }, - "width": 8, - "height": 6, - "x": 0, - "y": 48 + } + } + ] + } + } + ], + "Tags": [ + { + "Key": "stateMachine:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::IAM::Role" + }, + "throttler": { + "Metadata": { + "SamResourceId": "throttler" + }, + "Properties": { + "Code": { + "S3Bucket": "aws-sam-cli-managed-default-samclisourcebucket-167xnalzxxva4", + "S3Key": "sam-test-project/841a60f2d379216bd90fa34e033d0596" + }, + "Handler": "basic-handler.hello", + "ReservedConcurrentExecutions": 0, + "Role": { + "Fn::GetAtt": [ + "throttlerRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::Lambda::Function" + }, + "throttlerRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] } - ] + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" } - } - } + ] + }, + "Type": "AWS::IAM::Role" + }, + "vpc": { + "Metadata": { + "SamResourceId": "vpc" + }, + "Properties": { + "CidrBlock": "10.0.0.0/16" + }, + "Type": "AWS::EC2::VPC" } } } 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 index c37106b4..49b277fb 100644 --- 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 @@ -9,87 +9,245 @@ exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb- { "AWSTemplateFormatVersion": "2010-09-09", "Description": "The AWS CloudFormation template for this Serverless application", + "Outputs": { + "AlbEventLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Export": { + "Name": "sls-serverless-test-project-alb-dev-AlbEventLambdaFunctionQualifiedArn" + }, + "Value": { + "Ref": "AlbEventLambdaVersion0XznAenLykwY99KhRhuWhGA2GO8nTdlRqGtjPoaDgg" + } + }, + "ServerlessDeploymentBucketName": { + "Export": { + "Name": "sls-serverless-test-project-alb-dev-ServerlessDeploymentBucketName" + }, + "Value": { + "Ref": "ServerlessDeploymentBucket" + } + } + }, "Resources": { - "ServerlessDeploymentBucket": { - "Type": "AWS::S3::Bucket", + "alb": { "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "SSEAlgorithm": "AES256" - } + "Name": "awesome-loadBalancer", + "SecurityGroups": [ + { + "Ref": "albSecurityGroup" + } + ], + "Subnets": [ + { + "Ref": "subnetA" + }, + { + "Ref": "subnetB" + } + ], + "Type": "application" + }, + "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer" + }, + "AlbEventAlbListenerRule1": { + "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 + }, + "Type": "AWS::ElasticLoadBalancingV2::ListenerRule" }, - "ServerlessDeploymentBucketPolicy": { - "Type": "AWS::S3::BucketPolicy", + "AlbEventAlbTargetGrouphttpListener": { + "DependsOn": [ + "AlbEventLambdaPermissionRegisterTarget" + ], "Properties": { - "Bucket": { - "Ref": "ServerlessDeploymentBucket" + "HealthCheckEnabled": true, + "HealthCheckIntervalSeconds": 35, + "HealthCheckPath": "/", + "HealthCheckTimeoutSeconds": 30, + "HealthyThresholdCount": 5, + "Matcher": { + "HttpCode": "200" }, - "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 - } - } + "Name": "1d5fdfd5099ec257209ef7b7c5ee8cb4", + "Tags": [ + { + "Key": "Name", + "Value": "serverless-test-project-alb-albEvent-httpListener-dev" + } + ], + "TargetGroupAttributes": [ + { + "Key": "lambda.multi_value_headers.enabled", + "Value": false + } + ], + "Targets": [ + { + "Id": { + "Fn::GetAtt": [ + "AlbEventLambdaFunction", + "Arn" + ] } + } + ], + "TargetType": "lambda", + "UnhealthyThresholdCount": 5 + }, + "Type": "AWS::ElasticLoadBalancingV2::TargetGroup" + }, + "AlbEventLambdaFunction": { + "DependsOn": [ + "AlbEventLogGroup" + ], + "Metadata": { + "slicWatch": {} + }, + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project-alb/dev/1701242684385-2023-11-29T07:24:44.385Z/serverless-test-project-alb.zip" + }, + "FunctionName": "serverless-test-project-alb-dev-albEvent", + "Handler": "alb-handler.handleALB", + "MemorySize": 1024, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" ] + }, + "Runtime": "nodejs18.x", + "Timeout": 6 + }, + "Type": "AWS::Lambda::Function" + }, + "AlbEventLambdaPermissionAlb": { + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "AlbEventLambdaFunction", + "Arn" + ] + }, + "Principal": "elasticloadbalancing.amazonaws.com", + "SourceArn": { + "Ref": "AlbEventAlbTargetGrouphttpListener" } - } + }, + "Type": "AWS::Lambda::Permission" + }, + "AlbEventLambdaPermissionRegisterTarget": { + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "AlbEventLambdaFunction", + "Arn" + ] + }, + "Principal": "elasticloadbalancing.amazonaws.com" + }, + "Type": "AWS::Lambda::Permission" + }, + "AlbEventLambdaVersion0XznAenLykwY99KhRhuWhGA2GO8nTdlRqGtjPoaDgg": { + "DeletionPolicy": "Retain", + "Properties": { + "CodeSha256": "iF0ZcJ5dWZd/RnBzvEqO7WAQlHbLsco8p4dUx4U7AL8=", + "FunctionName": { + "Ref": "AlbEventLambdaFunction" + } + }, + "Type": "AWS::Lambda::Version" }, "AlbEventLogGroup": { - "Type": "AWS::Logs::LogGroup", "Properties": { "LogGroupName": "/aws/lambda/serverless-test-project-alb-dev-albEvent" - } + }, + "Type": "AWS::Logs::LogGroup" + }, + "albSecurityGroup": { + "Properties": { + "GroupDescription": "Allow http to client host", + "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" + } + ], + "VpcId": { + "Ref": "vpcALB" + } + }, + "Type": "AWS::EC2::SecurityGroup" + }, + "bucket": { + "Type": "AWS::S3::Bucket" + }, + "httpListener": { + "Properties": { + "DefaultActions": [ + { + "Type": "redirect", + "RedirectConfig": { + "Protocol": "HTTP", + "Port": 400, + "Host": "#{host}", + "Path": "/#{path}", + "Query": "#{query}", + "StatusCode": "HTTP_301" + } + } + ], + "LoadBalancerArn": { + "Ref": "alb" + }, + "Port": 80, + "Protocol": "HTTP" + }, + "Type": "AWS::ElasticLoadBalancingV2::Listener" }, "IamRoleLambdaExecution": { - "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { - "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", @@ -102,8 +260,10 @@ exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb- "sts:AssumeRole" ] } - ] + ], + "Version": "2012-10-17" }, + "Path": "/", "Policies": [ { "PolicyName": { @@ -138,182 +298,33 @@ exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb- "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" + { + "Fn::Sub": "arn:\${AWS::Partition}:logs:\${AWS::Region}:\${AWS::AccountId}:log-group:/aws/lambda/serverless-test-project-alb-dev*:*:*" + } + ] + } + ] + } + } + ], + "RoleName": { + "Fn::Join": [ + "-", + [ + "serverless-test-project-alb", + "dev", + { + "Ref": "AWS::Region" + }, + "lambdaRole" + ] ] - }, - "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" + }, + "Type": "AWS::IAM::Role" }, - "vpcALB": { - "Type": "AWS::EC2::VPC", + "internetGateway": { "Properties": { - "CidrBlock": "10.0.0.0/20", - "EnableDnsSupport": true, - "EnableDnsHostnames": true, - "InstanceTenancy": "default", "Tags": [ { "Key": "ProjectName", @@ -324,10 +335,10 @@ exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb- "Value": "dev" } ] - } + }, + "Type": "AWS::EC2::InternetGateway" }, - "internetGateway": { - "Type": "AWS::EC2::InternetGateway", + "routeTableA": { "Properties": { "Tags": [ { @@ -338,84 +349,52 @@ exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb- "Key": "Stage", "Value": "dev" } - ] - } - }, - "vpcGatewayAttachment": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { + ], "VpcId": { "Ref": "vpcALB" - }, - "InternetGatewayId": { - "Ref": "internetGateway" } - } + }, + "Type": "AWS::EC2::RouteTable" }, - "subnetA": { - "Type": "AWS::EC2::Subnet", + "routeTableAInternetRoute": { + "DependsOn": [ + "vpcGatewayAttachment" + ], "Properties": { - "AvailabilityZone": "eu-west-1a", - "CidrBlock": "10.0.5.0/24", - "VpcId": { - "Ref": "vpcALB" + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "internetGateway" }, - "Tags": [ - { - "Key": "ProjectName", - "Value": "serverless-test-project-alb" - }, - { - "Key": "Stage", - "Value": "dev" - } - ] - } + "RouteTableId": { + "Ref": "routeTableA" + } + }, + "Type": "AWS::EC2::Route" }, - "subnetB": { - "Type": "AWS::EC2::Subnet", + "routeTableAssociationSubnetA": { "Properties": { - "AvailabilityZone": "eu-west-1b", - "CidrBlock": "10.0.6.0/24", - "VpcId": { - "Ref": "vpcALB" + "RouteTableId": { + "Ref": "routeTableA" }, - "Tags": [ - { - "Key": "ProjectName", - "Value": "serverless-test-project-alb" - }, - { - "Key": "Stage", - "Value": "dev" - } - ] - } + "SubnetId": { + "Ref": "subnetA" + } + }, + "Type": "AWS::EC2::SubnetRouteTableAssociation" }, - "routeTableA": { - "Type": "AWS::EC2::RouteTable", + "routeTableAssociationSubnetB": { "Properties": { - "VpcId": { - "Ref": "vpcALB" + "RouteTableId": { + "Ref": "routeTableB" }, - "Tags": [ - { - "Key": "ProjectName", - "Value": "serverless-test-project-alb" - }, - { - "Key": "Stage", - "Value": "dev" - } - ] - } + "SubnetId": { + "Ref": "subnetB" + } + }, + "Type": "AWS::EC2::SubnetRouteTableAssociation" }, "routeTableB": { - "Type": "AWS::EC2::RouteTable", "Properties": { - "VpcId": { - "Ref": "vpcALB" - }, "Tags": [ { "Key": "ProjectName", @@ -425,129 +404,98 @@ exports[`serverless-test-project-alb/tests/snapshot/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" + ], + "VpcId": { + "Ref": "vpcALB" } - } + }, + "Type": "AWS::EC2::RouteTable" }, - "routeTableAInternetRoute": { - "Type": "AWS::EC2::Route", + "routeTableBInternetRoute": { "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" } - } + }, + "Type": "AWS::EC2::Route" }, - "alb": { - "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", + "ServerlessDeploymentBucket": { "Properties": { - "Name": "awesome-loadBalancer", - "Type": "application", - "Subnets": [ - { - "Ref": "subnetA" - }, - { - "Ref": "subnetB" - } - ], - "SecurityGroups": [ - { - "Ref": "albSecurityGroup" - } - ] - } + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + }, + "Type": "AWS::S3::Bucket" }, - "httpListener": { - "Type": "AWS::ElasticLoadBalancingV2::Listener", + "ServerlessDeploymentBucketPolicy": { "Properties": { - "LoadBalancerArn": { - "Ref": "alb" + "Bucket": { + "Ref": "ServerlessDeploymentBucket" }, - "Port": 80, - "Protocol": "HTTP", - "DefaultActions": [ - { - "Type": "redirect", - "RedirectConfig": { - "Protocol": "HTTP", - "Port": 400, - "Host": "#{host}", - "Path": "/#{path}", - "Query": "#{query}", - "StatusCode": "HTTP_301" + "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 + } + } } - } - ] - } - }, - "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" - } - ] - } + ] + } + }, + "Type": "AWS::S3::BucketPolicy" }, "slicWatchDashboard": { - "Type": "AWS::CloudWatch::Dashboard", "Properties": { "DashboardBody": { "Fn::Sub": { @@ -816,18 +764,18 @@ exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb- ] } } - } + }, + "Type": "AWS::CloudWatch::Dashboard" }, "slicWatchLoadBalancerHTTPCodeELB5XXCountAlarmAlb": { - "Type": "AWS::CloudWatch::Alarm", "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "MetricName": "HTTPCode_ELB_5XX_Count", - "Namespace": "AWS/ApplicationELB", + "AlarmDescription": "LoadBalancer HTTPCodeELB5XXCount Sum for alb breaches 0", + "AlarmName": "LoadBalancer_HTTPCodeELB5XXCountAlarm_alb", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { "Name": "LoadBalancer", @@ -839,27 +787,36 @@ exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb- } } ], - "AlarmName": "LoadBalancer_HTTPCodeELB5XXCountAlarm_alb", - "AlarmDescription": "LoadBalancer HTTPCodeELB5XXCount Sum for alb breaches 0", - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", + "MetricName": "HTTPCode_ELB_5XX_Count", + "Namespace": "AWS/ApplicationELB", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 0 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLoadBalancerRejectedConnectionCountAlarmAlb": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchLoadBalancerHTTPCodeTarget5XXCountAlarmAlbEventAlbTargetGrouphttpListener": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "MetricName": "RejectedConnectionCount", - "Namespace": "AWS/ApplicationELB", + "AlarmDescription": "LoadBalancer HTTPCode_Target_5XX_Count Sum for AlbEventAlbTargetGrouphttpListener breaches 0", + "AlarmName": "LoadBalancer_HTTPCodeTarget5XXCountAlarm_AlbEventAlbTargetGrouphttpListener", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ + { + "Name": "TargetGroup", + "Value": { + "Fn::GetAtt": [ + "AlbEventAlbTargetGrouphttpListener", + "TargetGroupFullName" + ] + } + }, { "Name": "LoadBalancer", "Value": { @@ -870,29 +827,26 @@ exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb- } } ], - "AlarmName": "LoadBalancer_RejectedConnectionCountAlarm_alb", - "AlarmDescription": "LoadBalancer RejectedConnectionCount Sum for alb breaches 0", - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", + "MetricName": "HTTPCode_Target_5XX_Count", + "Namespace": "AWS/ApplicationELB", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 0 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLoadBalancerHTTPCodeTarget5XXCountAlarmAlbEventAlbTargetGrouphttpListener": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchLoadBalancerLambdaInternalErrorAlarmAlbEventAlbTargetGrouphttpListener": { "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", + "AlarmDescription": "LoadBalancer LambdaInternalError Sum for AlbEventAlbTargetGrouphttpListener breaches 0", + "AlarmName": "LoadBalancer_LambdaInternalErrorAlarm_AlbEventAlbTargetGrouphttpListener", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { "Name": "TargetGroup", @@ -913,26 +867,26 @@ exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb- } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + "MetricName": "LambdaInternalError", + "Namespace": "AWS/ApplicationELB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLoadBalancerUnHealthyHostCountAlarmAlbEventAlbTargetGrouphttpListener": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchLoadBalancerLambdaUserErrorAlarmAlbEventAlbTargetGrouphttpListener": { "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", + "AlarmDescription": "LoadBalancer LambdaUserError Sum for AlbEventAlbTargetGrouphttpListener breaches 0", + "AlarmName": "LoadBalancer_LambdaUserErrorAlarm_AlbEventAlbTargetGrouphttpListener", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { "Name": "TargetGroup", @@ -953,36 +907,27 @@ exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb- } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + "MetricName": "LambdaUserError", + "Namespace": "AWS/ApplicationELB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLoadBalancerLambdaInternalErrorAlarmAlbEventAlbTargetGrouphttpListener": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchLoadBalancerRejectedConnectionCountAlarmAlb": { "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", + "AlarmDescription": "LoadBalancer RejectedConnectionCount Sum for alb breaches 0", + "AlarmName": "LoadBalancer_RejectedConnectionCountAlarm_alb", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ - { - "Name": "TargetGroup", - "Value": { - "Fn::GetAtt": [ - "AlbEventAlbTargetGrouphttpListener", - "TargetGroupFullName" - ] - } - }, { "Name": "LoadBalancer", "Value": { @@ -993,26 +938,26 @@ exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb- } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + "MetricName": "RejectedConnectionCount", + "Namespace": "AWS/ApplicationELB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLoadBalancerLambdaUserErrorAlarmAlbEventAlbTargetGrouphttpListener": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchLoadBalancerUnHealthyHostCountAlarmAlbEventAlbTargetGrouphttpListener": { "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", + "AlarmDescription": "LoadBalancer UnHealthyHostCount Average for AlbEventAlbTargetGrouphttpListener breaches 0", + "AlarmName": "LoadBalancer_UnHealthyHostCountAlarm_AlbEventAlbTargetGrouphttpListener", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { "Name": "TargetGroup", @@ -1033,31 +978,86 @@ exports[`serverless-test-project-alb/tests/snapshot/serverless-test-project-alb- } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } - } - }, - "Outputs": { - "ServerlessDeploymentBucketName": { - "Value": { - "Ref": "ServerlessDeploymentBucket" + "MetricName": "UnHealthyHostCount", + "Namespace": "AWS/ApplicationELB", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 0, + "TreatMissingData": "notBreaching" }, - "Export": { - "Name": "sls-serverless-test-project-alb-dev-ServerlessDeploymentBucketName" - } + "Type": "AWS::CloudWatch::Alarm" }, - "AlbEventLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "AlbEventLambdaVersion0XznAenLykwY99KhRhuWhGA2GO8nTdlRqGtjPoaDgg" + "subnetA": { + "Properties": { + "AvailabilityZone": "eu-west-1a", + "CidrBlock": "10.0.5.0/24", + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ], + "VpcId": { + "Ref": "vpcALB" + } }, - "Export": { - "Name": "sls-serverless-test-project-alb-dev-AlbEventLambdaFunctionQualifiedArn" - } + "Type": "AWS::EC2::Subnet" + }, + "subnetB": { + "Properties": { + "AvailabilityZone": "eu-west-1b", + "CidrBlock": "10.0.6.0/24", + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ], + "VpcId": { + "Ref": "vpcALB" + } + }, + "Type": "AWS::EC2::Subnet" + }, + "vpcALB": { + "Properties": { + "CidrBlock": "10.0.0.0/20", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "ProjectName", + "Value": "serverless-test-project-alb" + }, + { + "Key": "Stage", + "Value": "dev" + } + ] + }, + "Type": "AWS::EC2::VPC" + }, + "vpcGatewayAttachment": { + "Properties": { + "InternetGatewayId": { + "Ref": "internetGateway" + }, + "VpcId": { + "Ref": "vpcALB" + } + }, + "Type": "AWS::EC2::VPCGatewayAttachment" } } } 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 index 3b006dcf..7b5ec5d4 100644 --- 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 @@ -9,93 +9,262 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- { "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" - } - } - ] + "Outputs": { + "AwesomeappsyncGraphQlApiId": { + "Export": { + "Name": { + "Fn::Sub": "\${AWS::StackName}-AwesomeappsyncGraphQlApiId" + } + }, + "Value": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + } + }, + "AwesomeappsyncGraphQlApiUrl": { + "Export": { + "Name": { + "Fn::Sub": "\${AWS::StackName}-AwesomeappsyncGraphQlApiUrl" } + }, + "Value": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "GraphQLUrl" + ] } }, - "ServerlessDeploymentBucketPolicy": { - "Type": "AWS::S3::BucketPolicy", + "ServerlessDeploymentBucketName": { + "Export": { + "Name": "sls-serverless-test-project-appsync-dev-ServerlessDeploymentBucketName" + }, + "Value": { + "Ref": "ServerlessDeploymentBucket" + } + } + }, + "Resources": { + "AwesomeappsyncGraphQlApi": { "Properties": { - "Bucket": { - "Ref": "ServerlessDeploymentBucket" + "AdditionalAuthenticationProviders": [], + "AuthenticationType": "AMAZON_COGNITO_USER_POOLS", + "Name": "awesome-appsync", + "UserPoolConfig": { + "AwsRegion": "eu-west-1", + "DefaultAction": "ALLOW", + "UserPoolId": { + "Ref": "CognitoUserPool" + } }, - "PolicyDocument": { + "XrayEnabled": false + }, + "Type": "AWS::AppSync::GraphQLApi" + }, + "AwesomeappsyncGraphQlDsbooksTable": { + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + }, + "DynamoDBConfig": { + "AwsRegion": "eu-west-1", + "TableName": { + "Ref": "BooksTable" + }, + "UseCallerCredentials": false, + "Versioned": false + }, + "Name": "booksTable", + "ServiceRoleArn": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlDsbooksTableRole", + "Arn" + ] + }, + "Type": "AMAZON_DYNAMODB" + }, + "Type": "AWS::AppSync::DataSource" + }, + "AwesomeappsyncGraphQlDsbooksTableRole": { + "Properties": { + "AssumeRolePolicyDocument": { "Statement": [ { - "Action": "s3:*", - "Effect": "Deny", - "Principal": "*", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":s3:::", - { - "Ref": "ServerlessDeploymentBucket" - }, - "/*" - ] - ] - }, + "Effect": "Allow", + "Principal": { + "Service": [ + "appsync.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyName": "GraphQlDsbooksTablePolicy", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":s3:::", - { - "Ref": "ServerlessDeploymentBucket" - } - ] + "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" + } + ] + ] + } + ] + ] + }, + "*" + ] + ] + } ] } - ], - "Condition": { - "Bool": { - "aws:SecureTransport": false - } - } + ] } + } + ] + }, + "Type": "AWS::IAM::Role" + }, + "AwesomeappsyncGraphQlResolverMutationcreateBook": { + "DependsOn": "AwesomeappsyncGraphQlSchema", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" ] - } - } + }, + "DataSourceName": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlDsbooksTable", + "Name" + ] + }, + "FieldName": "createBook", + "Kind": "UNIT", + "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)", + "TypeName": "Mutation" + }, + "Type": "AWS::AppSync::Resolver" }, - "bucket": { - "Type": "AWS::S3::Bucket" + "AwesomeappsyncGraphQlResolverQuerygetBookById": { + "DependsOn": "AwesomeappsyncGraphQlSchema", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + }, + "DataSourceName": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlDsbooksTable", + "Name" + ] + }, + "FieldName": "getBookById", + "Kind": "UNIT", + "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)", + "TypeName": "Query" + }, + "Type": "AWS::AppSync::Resolver" + }, + "AwesomeappsyncGraphQlSchema": { + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + }, + "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}" + }, + "Type": "AWS::AppSync::GraphQLSchema" }, "BooksTable": { - "Type": "AWS::DynamoDB::Table", "Properties": { - "BillingMode": "PAY_PER_REQUEST", - "KeySchema": [ + "AttributeDefinitions": [ { "AttributeName": "bookId", - "KeyType": "HASH" + "AttributeType": "S" } ], - "AttributeDefinitions": [ + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ { "AttributeName": "bookId", - "AttributeType": "S" + "KeyType": "HASH" } ], "Tags": [ @@ -104,58 +273,15 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- "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" - } + }, + "Type": "AWS::DynamoDB::Table" }, - "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" - } + "bucket": { + "Type": "AWS::S3::Bucket" }, - "CognitoAdminGroup": { - "Type": "AWS::Cognito::UserPoolGroup", - "Properties": { - "UserPoolId": { - "Ref": "CognitoUserPool" - }, + "CognitoAdminGroup": { + "Properties": { + "Description": "Admin users belong to this group", "GroupName": "Admin", "RoleArn": { "Fn::GetAtt": [ @@ -163,14 +289,15 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- "Arn" ] }, - "Description": "Admin users belong to this group" - } + "UserPoolId": { + "Ref": "CognitoUserPool" + } + }, + "Type": "AWS::Cognito::UserPoolGroup" }, "CognitoAdminIAMrole": { - "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { - "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", @@ -183,7 +310,8 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- "sts:AssumeRoleWithWebIdentity" ] } - ] + ], + "Version": "2012-10-17" }, "Description": "This is the IAM role that admin group users name", "Policies": [ @@ -211,14 +339,12 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- } ], "RoleName": "bookstore-admin-role" - } + }, + "Type": "AWS::IAM::Role" }, "CognitoCustomerGroup": { - "Type": "AWS::Cognito::UserPoolGroup", "Properties": { - "UserPoolId": { - "Ref": "CognitoUserPool" - }, + "Description": "Customer belongs to this group", "GroupName": "Customer", "RoleArn": { "Fn::GetAtt": [ @@ -226,14 +352,15 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- "Arn" ] }, - "Description": "Customer belongs to this group" - } + "UserPoolId": { + "Ref": "CognitoUserPool" + } + }, + "Type": "AWS::Cognito::UserPoolGroup" }, "CognitoUserIAMrole": { - "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { - "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", @@ -246,7 +373,8 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- "sts:AssumeRoleWithWebIdentity" ] } - ] + ], + "Version": "2012-10-17" }, "Description": "This is the IAM role that admin group users name", "Policies": [ @@ -276,216 +404,185 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- } ], "RoleName": "bookstore-customer-role" - } + }, + "Type": "AWS::IAM::Role" }, - "AwesomeappsyncGraphQlApi": { - "Type": "AWS::AppSync::GraphQLApi", + "CognitoUserPool": { "Properties": { - "Name": "awesome-appsync", - "AuthenticationType": "AMAZON_COGNITO_USER_POOLS", - "AdditionalAuthenticationProviders": [], - "UserPoolConfig": { - "AwsRegion": "eu-west-1", - "UserPoolId": { - "Ref": "CognitoUserPool" - }, - "DefaultAction": "ALLOW" + "AutoVerifiedAttributes": [ + "email" + ], + "Policies": { + "PasswordPolicy": { + "MinimumLength": 8, + "RequireLowercase": false, + "RequireNumbers": false, + "RequireSymbols": false, + "RequireUppercase": false + } }, - "XrayEnabled": false - } + "Schema": [ + { + "AttributeDataType": "String", + "Name": "name", + "Required": false, + "Mutable": true + } + ], + "UsernameAttributes": [ + "email" + ], + "UserPoolName": "BookStoreUserPool" + }, + "Type": "AWS::Cognito::UserPool" }, - "AwesomeappsyncGraphQlSchema": { - "Type": "AWS::AppSync::GraphQLSchema", + "CognitoUserPoolClient": { "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" - ] + "ClientName": "web", + "ExplicitAuthFlows": [ + "ALLOW_USER_SRP_AUTH", + "ALLOW_USER_PASSWORD_AUTH", + "ALLOW_REFRESH_TOKEN_AUTH" + ], + "PreventUserExistenceErrors": "ENABLED", + "UserPoolId": { + "Ref": "CognitoUserPool" } - } + }, + "Type": "AWS::Cognito::UserPoolClient" }, - "AwesomeappsyncGraphQlDsbooksTableRole": { - "Type": "AWS::IAM::Role", + "ServerlessDeploymentBucket": { "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ { - "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" - } - ] - ] - } - ] - ] - }, - "*" - ] - ] - } - ] - } - ] + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } } - } - ] - } - }, - "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 } - } + }, + "Type": "AWS::S3::Bucket" }, - "AwesomeappsyncGraphQlResolverQuerygetBookById": { - "Type": "AWS::AppSync::Resolver", - "DependsOn": "AwesomeappsyncGraphQlSchema", + "ServerlessDeploymentBucketPolicy": { "Properties": { - "ApiId": { - "Fn::GetAtt": [ - "AwesomeappsyncGraphQlApi", - "ApiId" - ] + "Bucket": { + "Ref": "ServerlessDeploymentBucket" }, - "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" + "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 + } + } + } ] } - } + }, + "Type": "AWS::S3::BucketPolicy" }, - "AwesomeappsyncGraphQlResolverMutationcreateBook": { - "Type": "AWS::AppSync::Resolver", - "DependsOn": "AwesomeappsyncGraphQlSchema", + "slicWatchAppSync5XXErrorAlarmawesomeappsync": { "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" - ] - } - } + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "AlarmDescription": "AppSync 5XXError Sum for awesome-appsync breaches 0", + "AlarmName": "AppSync_5XXErrorAlarm_awesome-appsync", + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "GraphQLAPIId", + "Value": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "5XXError", + "Namespace": "AWS/AppSync", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "slicWatchAppSyncLatencyAlarmawesomeappsync": { + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "AlarmDescription": "AppSync Latency Average for awesome-appsync breaches 0", + "AlarmName": "AppSync_LatencyAlarm_awesome-appsync", + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "GraphQLAPIId", + "Value": { + "Fn::GetAtt": [ + "AwesomeappsyncGraphQlApi", + "ApiId" + ] + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Latency", + "Namespace": "AWS/AppSync", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, "slicWatchDashboard": { - "Type": "AWS::CloudWatch::Dashboard", "Properties": { "DashboardBody": { "Fn::Sub": { @@ -671,30 +768,28 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- ] } } - } + }, + "Type": "AWS::CloudWatch::Dashboard" }, "slicWatchTableReadThrottleEventsAlarmBooksTable": { - "Type": "AWS::CloudWatch::Alarm", "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "DDB_ReadThrottleEvents_Alarm_\${BooksTable}", + "DynamoDB Sum for \${BooksTable} breaches 10", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "DynamoDB Sum for \${BooksTable} breaches 10", + "DDB_ReadThrottleEvents_Alarm_\${BooksTable}", {} ] }, - "MetricName": "ReadThrottleEvents", - "Namespace": "AWS/DynamoDB", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { "Name": "TableName", @@ -703,36 +798,36 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 10 - } + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchTableWriteThrottleEventsAlarmBooksTable": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchTableSystemErrorsAlarmBooksTable": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "DDB_WriteThrottleEvents_Alarm_\${BooksTable}", + "DynamoDB Sum for \${BooksTable} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "DynamoDB Sum for \${BooksTable} breaches 10", + "DDB_SystemErrors_Alarm_\${BooksTable}", {} ] }, - "MetricName": "WriteThrottleEvents", - "Namespace": "AWS/DynamoDB", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { "Name": "TableName", @@ -741,36 +836,36 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", + "MetricName": "SystemErrors", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 10 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, "slicWatchTableUserErrorsAlarmBooksTable": { - "Type": "AWS::CloudWatch::Alarm", "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "DDB_UserErrors_Alarm_\${BooksTable}", + "DynamoDB Sum for \${BooksTable} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "DynamoDB Sum for \${BooksTable} breaches 0", + "DDB_UserErrors_Alarm_\${BooksTable}", {} ] }, - "MetricName": "UserErrors", - "Namespace": "AWS/DynamoDB", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { "Name": "TableName", @@ -779,36 +874,36 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", + "MetricName": "UserErrors", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 0 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchTableSystemErrorsAlarmBooksTable": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchTableWriteThrottleEventsAlarmBooksTable": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "DDB_SystemErrors_Alarm_\${BooksTable}", + "DynamoDB Sum for \${BooksTable} breaches 10", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "DynamoDB Sum for \${BooksTable} breaches 0", + "DDB_WriteThrottleEvents_Alarm_\${BooksTable}", {} ] }, - "MetricName": "SystemErrors", - "Namespace": "AWS/DynamoDB", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { "Name": "TableName", @@ -817,111 +912,16 @@ exports[`serverless-test-project-appsync/tests/snapshot/serverless-test-project- } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 0 - } - }, - "slicWatchAppSync5XXErrorAlarmawesomeappsync": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "ActionsEnabled": true, - "AlarmActions": [ - "test-topic" - ], + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", "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" - ] + "Threshold": 10, + "TreatMissingData": "notBreaching" }, - "Export": { - "Name": { - "Fn::Sub": "\${AWS::StackName}-AwesomeappsyncGraphQlApiUrl" - } - } + "Type": "AWS::CloudWatch::Alarm" } } } 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 index 8a08a9f3..f83a4b33 100644 --- 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 @@ -9,393 +9,402 @@ exports[`serverless-test-project/tests/snapshot/serverless-test-project-snapshot { "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" - } - } - ] - } + "Outputs": { + "DriveQueueLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Export": { + "Name": "sls-serverless-test-project-dev-DriveQueueLambdaFunctionQualifiedArn" + }, + "Value": { + "Ref": "DriveQueueLambdaVersionTmzx8HCxfunJ3etrLOOYLg8zG05MzRauykeVpZFz8WY" } }, - "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 - } - } - } - ] - } + "DriveStreamLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Export": { + "Name": "sls-serverless-test-project-dev-DriveStreamLambdaFunctionQualifiedArn" + }, + "Value": { + "Ref": "DriveStreamLambdaVersionsWkqlV7IV7mJdqIqQToVljMizTzZoDCso7qMazjI" } }, - "HelloLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/serverless-test-project-dev-hello" + "DriveTableLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Export": { + "Name": "sls-serverless-test-project-dev-DriveTableLambdaFunctionQualifiedArn" + }, + "Value": { + "Ref": "DriveTableLambdaVersionkqI0DCnUasgza04mnCpqj0q5vePTOojYtyi4hxfE3ME" } }, - "PingLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/serverless-test-project-dev-ping" + "EventsRuleLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Export": { + "Name": "sls-serverless-test-project-dev-EventsRuleLambdaFunctionQualifiedArn" + }, + "Value": { + "Ref": "EventsRuleLambdaVersionxBuN447jfeozyKD2CEV3oCIHhShTUOVe5XKOkBlbchQ" } }, - "ThrottlerLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/serverless-test-project-dev-throttler" + "ExpressWorkflowArn": { + "Description": "Current StateMachine Arn", + "Export": { + "Name": "sls-serverless-test-project-dev-ExpressWorkflowArn" + }, + "Value": { + "Ref": "ExpressWorkflow" } }, - "DriveStreamLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/serverless-test-project-dev-driveStream" + "HelloLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Export": { + "Name": "sls-serverless-test-project-dev-HelloLambdaFunctionQualifiedArn" + }, + "Value": { + "Ref": "HelloLambdaVersioncvZrQjYr4FdYsM3CaTj5TKuOJmUjyL07tfIDVXBSw4" } }, - "DriveQueueLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/serverless-test-project-dev-driveQueue" + "HttpGetterLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Export": { + "Name": "sls-serverless-test-project-dev-HttpGetterLambdaFunctionQualifiedArn" + }, + "Value": { + "Ref": "HttpGetterLambdaVersionvK2ALwc1DFqBccIyulxoBU3GveALO98nQc2xP94J8" } }, - "DriveTableLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/serverless-test-project-dev-driveTable" + "PingLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Export": { + "Name": "sls-serverless-test-project-dev-PingLambdaFunctionQualifiedArn" + }, + "Value": { + "Ref": "PingLambdaVersionSQcuddhSFqI0xKYCyuQTTJMvwrlKCB77CNQ16xyQ" } }, - "StreamProcessorLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/serverless-test-project-dev-streamProcessor" + "ServerlessDeploymentBucketName": { + "Export": { + "Name": "sls-serverless-test-project-dev-ServerlessDeploymentBucketName" + }, + "Value": { + "Ref": "ServerlessDeploymentBucket" } }, - "HttpGetterLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/serverless-test-project-dev-httpGetter" + "ServiceEndpoint": { + "Description": "URL of the service endpoint", + "Export": { + "Name": "sls-serverless-test-project-dev-ServiceEndpoint" + }, + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "ApiGatewayRestApi" + }, + ".execute-api.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/dev" + ] + ] } }, - "SubscriptionHandlerLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/serverless-test-project-dev-subscriptionHandler" + "StreamProcessorLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Export": { + "Name": "sls-serverless-test-project-dev-StreamProcessorLambdaFunctionQualifiedArn" + }, + "Value": { + "Ref": "StreamProcessorLambdaVersion24Kwch4oq5ogXKcIDJuLGB1qAJWt8aqgW43aCjKI" } }, - "EventsRuleLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/serverless-test-project-dev-eventsRule" + "SubscriptionHandlerLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Export": { + "Name": "sls-serverless-test-project-dev-SubscriptionHandlerLambdaFunctionQualifiedArn" + }, + "Value": { + "Ref": "SubscriptionHandlerLambdaVersion4kKEYaIgWsMN0XYzRQn4VAailfQcZ23kdSSOKepfB4A" } }, - "IamRoleLambdaExecution": { - "Type": "AWS::IAM::Role", + "ThrottlerLambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Export": { + "Name": "sls-serverless-test-project-dev-ThrottlerLambdaFunctionQualifiedArn" + }, + "Value": { + "Ref": "ThrottlerLambdaVersion0UeWLgxZYywcyV3gGiutpyCQJEbO6Gk8zSSOP7dMEps" + } + }, + "WorkflowArn": { + "Description": "Current StateMachine Arn", + "Export": { + "Name": "sls-serverless-test-project-dev-WorkflowArn" + }, + "Value": { + "Ref": "Workflow" + } + } + }, + "Resources": { + "ApiGatewayDeployment1701242215363": { + "DependsOn": [ + "ApiGatewayMethodItemGet", + "ApiGatewayMethodSubscriptionPost" + ], "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "Service": [ - "lambda.amazonaws.com" - ] - }, - "Action": [ - "sts:AssumeRole" - ] - } - ] + "RestApiId": { + "Ref": "ApiGatewayRestApi" }, - "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*:*" - } - ] + "StageName": "dev" + }, + "Type": "AWS::ApiGateway::Deployment" + }, + "ApiGatewayMethodItemGet": { + "DependsOn": [ + "HttpGetterLambdaPermissionApiGateway" + ], + "Properties": { + "ApiKeyRequired": false, + "AuthorizationType": "NONE", + "HttpMethod": "GET", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" }, + ":apigateway:", { - "Effect": "Allow", - "Action": [ - "logs:PutLogEvents" - ], - "Resource": [ - { - "Fn::Sub": "arn:\${AWS::Partition}:logs:\${AWS::Region}:\${AWS::AccountId}:log-group:/aws/lambda/serverless-test-project-dev*:*:*" - } - ] + "Ref": "AWS::Region" }, + ":lambda:path/2015-03-31/functions/", { - "Effect": "Allow", - "Action": [ - "kinesis:GetRecords", - "kinesis:GetShardIterator", - "kinesis:DescribeStream", - "kinesis:ListStreams" - ], - "Resource": [ - { - "Fn::GetAtt": [ - "stream", - "Arn" - ] - } + "Fn::GetAtt": [ + "HttpGetterLambdaFunction", + "Arn" ] - } + }, + "/invocations" ] - } - } - ], - "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" - ] + "MethodResponses": [], + "RequestParameters": {}, + "ResourceId": { + "Ref": "ApiGatewayResourceItem" + }, + "RestApiId": { + "Ref": "ApiGatewayRestApi" } }, + "Type": "AWS::ApiGateway::Method" + }, + "ApiGatewayMethodSubscriptionPost": { "DependsOn": [ - "HelloLogGroup" + "SubscriptionHandlerLambdaPermissionApiGateway" ], - "Metadata": { - "slicWatch": { - "alarms": { - "Lambda": { - "Invocations": { - "Threshold": 2 - } - } + "Properties": { + "ApiKeyRequired": false, + "AuthorizationType": "NONE", + "HttpMethod": "POST", + "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": [], + "RequestParameters": {}, + "ResourceId": { + "Ref": "ApiGatewayResourceSubscription" + }, + "RestApiId": { + "Ref": "ApiGatewayRestApi" } - } + }, + "Type": "AWS::ApiGateway::Method" }, - "PingLambdaFunction": { - "Type": "AWS::Lambda::Function", + "ApiGatewayResourceItem": { "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": { + "ParentId": { "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" + "ApiGatewayRestApi", + "RootResourceId" ] + }, + "PathPart": "item", + "RestApiId": { + "Ref": "ApiGatewayRestApi" } }, - "DependsOn": [ - "PingLogGroup" - ], - "Metadata": { - "slicWatch": { - "dashboard": { - "enabled": false - } - } - } + "Type": "AWS::ApiGateway::Resource" }, - "ThrottlerLambdaFunction": { - "Type": "AWS::Lambda::Function", + "ApiGatewayResourceSubscription": { "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": { + "ParentId": { "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" + "ApiGatewayRestApi", + "RootResourceId" ] }, - "ReservedConcurrentExecutions": 0 + "PathPart": "subscription", + "RestApiId": { + "Ref": "ApiGatewayRestApi" + } }, - "DependsOn": [ - "ThrottlerLogGroup" - ], - "Metadata": { - "slicWatch": {} - } + "Type": "AWS::ApiGateway::Resource" }, - "DriveStreamLambdaFunction": { - "Type": "AWS::Lambda::Function", + "ApiGatewayRestApi": { "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" + "EndpointConfiguration": { + "Types": [ + "REGIONAL" ] + }, + "Name": "dev-serverless-test-project", + "Policy": "" + }, + "Type": "AWS::ApiGateway::RestApi" + }, + "bucket": { + "Properties": { + "BucketName": { + "Fn::Sub": "slic-watch-test-project-bucket-\${AWS::AccountId}-\${AWS::Region}" } }, - "DependsOn": [ - "DriveStreamLogGroup" - ], - "Metadata": { - "slicWatch": {} - } + "Type": "AWS::S3::Bucket" }, - "DriveQueueLambdaFunction": { - "Type": "AWS::Lambda::Function", + "dataTable": { + "DeletionPolicy": "Delete", "Properties": { - "Code": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" + "AttributeDefinitions": [ + { + "AttributeName": "pk", + "AttributeType": "S" }, - "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + { + "AttributeName": "sk", + "AttributeType": "S" + }, + { + "AttributeName": "gsi1pk", + "AttributeType": "S" + }, + { + "AttributeName": "gsi1sk", + "AttributeType": "S" + }, + { + "AttributeName": "timestamp", + "AttributeType": "N" + } + ], + "GlobalSecondaryIndexes": [ + { + "IndexName": "GSI1", + "ProvisionedThroughput": { + "ReadCapacityUnits": 1, + "WriteCapacityUnits": 1 + }, + "KeySchema": [ + { + "AttributeName": "gsi1pk", + "KeyType": "HASH" + }, + { + "AttributeName": "gsi1sk", + "KeyType": "RANGE" + } + ], + "Projection": { + "NonKeyAttributes": [ + "address" + ], + "ProjectionType": "INCLUDE" + } + } + ], + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "sk", + "KeyType": "RANGE" + } + ], + "LocalSecondaryIndexes": [ + { + "IndexName": "LSI1", + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "timestamp", + "KeyType": "RANGE" + } + ], + "Projection": { + "NonKeyAttributes": [ + "name" + ], + "ProjectionType": "INCLUDE" + } + } + ], + "ProvisionedThroughput": { + "ReadCapacityUnits": 1, + "WriteCapacityUnits": 1 }, - "Handler": "queue-test-handler.handleDrive", - "Runtime": "nodejs18.x", - "FunctionName": "serverless-test-project-dev-driveQueue", - "MemorySize": 1024, - "Timeout": 6, - "Role": { - "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" - ] - } + "TableName": "MyTable" }, + "Type": "AWS::DynamoDB::Table" + }, + "DriveQueueLambdaFunction": { "DependsOn": [ "DriveQueueLogGroup" ], "Metadata": { "slicWatch": {} - } - }, - "DriveTableLambdaFunction": { - "Type": "AWS::Lambda::Function", + }, "Properties": { "Code": { "S3Bucket": { @@ -403,83 +412,43 @@ exports[`serverless-test-project/tests/snapshot/serverless-test-project-snapshot }, "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", + "FunctionName": "serverless-test-project-dev-driveQueue", + "Handler": "queue-test-handler.handleDrive", "MemorySize": 1024, - "Timeout": 6, "Role": { "Fn::GetAtt": [ "IamRoleLambdaExecution", "Arn" ] - } + }, + "Runtime": "nodejs18.x", + "Timeout": 6 }, - "DependsOn": [ - "DriveTableLogGroup" - ], - "Metadata": { - "slicWatch": {} - } + "Type": "AWS::Lambda::Function" }, - "StreamProcessorLambdaFunction": { - "Type": "AWS::Lambda::Function", + "DriveQueueLambdaVersionTmzx8HCxfunJ3etrLOOYLg8zG05MzRauykeVpZFz8WY": { + "DeletionPolicy": "Retain", "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" - ] + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=", + "FunctionName": { + "Ref": "DriveQueueLambdaFunction" } }, - "DependsOn": [ - "StreamProcessorLogGroup" - ], - "Metadata": { - "slicWatch": {} - } + "Type": "AWS::Lambda::Version" }, - "HttpGetterLambdaFunction": { - "Type": "AWS::Lambda::Function", + "DriveQueueLogGroup": { "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" - ] - } + "LogGroupName": "/aws/lambda/serverless-test-project-dev-driveQueue" }, + "Type": "AWS::Logs::LogGroup" + }, + "DriveStreamLambdaFunction": { "DependsOn": [ - "HttpGetterLogGroup" + "DriveStreamLogGroup" ], "Metadata": { "slicWatch": {} - } - }, - "SubscriptionHandlerLambdaFunction": { - "Type": "AWS::Lambda::Function", + }, "Properties": { "Code": { "S3Bucket": { @@ -487,27 +456,50 @@ exports[`serverless-test-project/tests/snapshot/serverless-test-project-snapshot }, "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", + "Environment": { + "Variables": { + "STREAM_NAME": { + "Ref": "stream" + } + } + }, + "FunctionName": "serverless-test-project-dev-driveStream", + "Handler": "stream-test-handler.handleDrive", "MemorySize": 1024, - "Timeout": 30, "Role": { "Fn::GetAtt": [ "IamRoleLambdaExecution", "Arn" ] + }, + "Runtime": "nodejs18.x", + "Timeout": 6 + }, + "Type": "AWS::Lambda::Function" + }, + "DriveStreamLambdaVersionsWkqlV7IV7mJdqIqQToVljMizTzZoDCso7qMazjI": { + "DeletionPolicy": "Retain", + "Properties": { + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=", + "FunctionName": { + "Ref": "DriveStreamLambdaFunction" } }, + "Type": "AWS::Lambda::Version" + }, + "DriveStreamLogGroup": { + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-driveStream" + }, + "Type": "AWS::Logs::LogGroup" + }, + "DriveTableLambdaFunction": { "DependsOn": [ - "SubscriptionHandlerLogGroup" + "DriveTableLogGroup" ], "Metadata": { "slicWatch": {} - } - }, - "EventsRuleLambdaFunction": { - "Type": "AWS::Lambda::Function", + }, "Properties": { "Code": { "S3Bucket": { @@ -515,206 +507,212 @@ exports[`serverless-test-project/tests/snapshot/serverless-test-project-snapshot }, "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", + "FunctionName": "serverless-test-project-dev-driveTable", + "Handler": "table-test-hander.handleDrive", "MemorySize": 1024, - "Timeout": 6, "Role": { "Fn::GetAtt": [ "IamRoleLambdaExecution", "Arn" ] - } + }, + "Runtime": "nodejs18.x", + "Timeout": 6 }, - "DependsOn": [ - "EventsRuleLogGroup" - ], - "Metadata": { - "slicWatch": { - "alarms": { - "Lambda": { - "enabled": false - } - } - } - } + "Type": "AWS::Lambda::Function" }, - "HelloLambdaVersioncvZrQjYr4FdYsM3CaTj5TKuOJmUjyL07tfIDVXBSw4": { - "Type": "AWS::Lambda::Version", + "DriveTableLambdaVersionkqI0DCnUasgza04mnCpqj0q5vePTOojYtyi4hxfE3ME": { "DeletionPolicy": "Retain", "Properties": { + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=", "FunctionName": { - "Ref": "HelloLambdaFunction" - }, - "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" - } + "Ref": "DriveTableLambdaFunction" + } + }, + "Type": "AWS::Lambda::Version" }, - "PingLambdaVersionSQcuddhSFqI0xKYCyuQTTJMvwrlKCB77CNQ16xyQ": { - "Type": "AWS::Lambda::Version", - "DeletionPolicy": "Retain", + "DriveTableLogGroup": { "Properties": { - "FunctionName": { - "Ref": "PingLambdaFunction" - }, - "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" - } + "LogGroupName": "/aws/lambda/serverless-test-project-dev-driveTable" + }, + "Type": "AWS::Logs::LogGroup" }, - "ThrottlerLambdaVersion0UeWLgxZYywcyV3gGiutpyCQJEbO6Gk8zSSOP7dMEps": { - "Type": "AWS::Lambda::Version", - "DeletionPolicy": "Retain", + "ecsCluster": { "Properties": { - "FunctionName": { - "Ref": "ThrottlerLambdaFunction" - }, - "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" - } + "ClusterName": "awesome-cluster" + }, + "Type": "AWS::ECS::Cluster" }, - "DriveStreamLambdaVersionsWkqlV7IV7mJdqIqQToVljMizTzZoDCso7qMazjI": { - "Type": "AWS::Lambda::Version", - "DeletionPolicy": "Retain", + "ecsService": { "Properties": { - "FunctionName": { - "Ref": "DriveStreamLambdaFunction" + "Cluster": { + "Ref": "ecsCluster" }, - "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" + "DesiredCount": 0, + "LaunchType": "FARGATE", + "NetworkConfiguration": { + "AwsvpcConfiguration": { + "AssignPublicIp": "ENABLED", + "SecurityGroups": [], + "Subnets": [ + { + "Ref": "subnet" + } + ] + } }, - "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" - } + "ServiceName": "awesome-service", + "TaskDefinition": { + "Ref": "taskDef" + } + }, + "Type": "AWS::ECS::Service" }, - "StreamProcessorLambdaVersion24Kwch4oq5ogXKcIDJuLGB1qAJWt8aqgW43aCjKI": { - "Type": "AWS::Lambda::Version", - "DeletionPolicy": "Retain", + "EventsRuleEventBridgeLambdaPermission1": { "Properties": { + "Action": "lambda:InvokeFunction", "FunctionName": { - "Ref": "StreamProcessorLambdaFunction" + "Fn::GetAtt": [ + "EventsRuleLambdaFunction", + "Arn" + ] }, - "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" - } + "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" + ] + ] + } + ] + ] + } + }, + "Type": "AWS::Lambda::Permission" }, - "HttpGetterLambdaVersionvK2ALwc1DFqBccIyulxoBU3GveALO98nQc2xP94J8": { - "Type": "AWS::Lambda::Version", - "DeletionPolicy": "Retain", + "EventsRuleLambdaFunction": { + "DependsOn": [ + "EventsRuleLogGroup" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "enabled": false + } + } + } + }, "Properties": { - "FunctionName": { - "Ref": "HttpGetterLambdaFunction" + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" }, - "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" - } - }, - "SubscriptionHandlerLambdaVersion4kKEYaIgWsMN0XYzRQn4VAailfQcZ23kdSSOKepfB4A": { - "Type": "AWS::Lambda::Version", - "DeletionPolicy": "Retain", - "Properties": { - "FunctionName": { - "Ref": "SubscriptionHandlerLambdaFunction" + "FunctionName": "serverless-test-project-dev-eventsRule", + "Handler": "rule-handler.handleRule", + "MemorySize": 1024, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] }, - "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" - } + "Runtime": "nodejs18.x", + "Timeout": 6 + }, + "Type": "AWS::Lambda::Function" }, "EventsRuleLambdaVersionxBuN447jfeozyKD2CEV3oCIHhShTUOVe5XKOkBlbchQ": { - "Type": "AWS::Lambda::Version", "DeletionPolicy": "Retain", "Properties": { + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=", "FunctionName": { "Ref": "EventsRuleLambdaFunction" - }, - "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=" - } + } + }, + "Type": "AWS::Lambda::Version" }, - "WorkflowRole": { - "Type": "AWS::IAM::Role", + "EventsRuleLogGroup": { "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ + "LogGroupName": "/aws/lambda/serverless-test-project-dev-eventsRule" + }, + "Type": "AWS::Logs::LogGroup" + }, + "ExpressWorkflow": { + "DependsOn": [ + "ExpressWorkflowRole" + ], + "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}", { - "Effect": "Allow", - "Principal": { - "Service": { - "Fn::Sub": "states.\${AWS::Region}.amazonaws.com" - } - }, - "Action": "sts:AssumeRole" + "085edd942ce144c5bd80364a6e973e4d": { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + } } ] }, - "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" - ] - } - } - ] - } + "LoggingConfiguration": { + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "expressWorkflowLogGroup", + "Arn" ] - }, - { - "Effect": "Allow", - "Action": [ - "logs:CreateLogDelivery", - "logs:GetLogDelivery", - "logs:UpdateLogDelivery", - "logs:DeleteLogDelivery", - "logs:ListLogDeliveries", - "logs:PutResourcePolicy", - "logs:DescribeResourcePolicies", - "logs:DescribeLogGroups" - ], - "Resource": "*" } - ] + } } - } - ] - } + ], + "IncludeExecutionData": true, + "Level": "ALL" + }, + "RoleArn": { + "Fn::GetAtt": [ + "ExpressWorkflowRole", + "Arn" + ] + }, + "StateMachineName": "ExpressWorkflow", + "StateMachineType": "EXPRESS" + }, + "Type": "AWS::StepFunctions::StateMachine" + }, + "expressWorkflowLogGroup": { + "Properties": { + "LogGroupName": "ExpressWorkflowLogs", + "RetentionInDays": 1 + }, + "Type": "AWS::Logs::LogGroup" }, "ExpressWorkflowRole": { - "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { - "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", @@ -725,7 +723,8 @@ exports[`serverless-test-project/tests/snapshot/serverless-test-project-snapshot }, "Action": "sts:AssumeRole" } - ] + ], + "Version": "2012-10-17" }, "Policies": [ { @@ -778,254 +777,105 @@ exports[`serverless-test-project/tests/snapshot/serverless-test-project-snapshot } } ] - } + }, + "Type": "AWS::IAM::Role" }, - "Workflow": { - "Type": "AWS::StepFunctions::StateMachine", + "fifoQueue": { "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" - ] + "FifoQueue": true, + "QueueName": "SomeFifoQueue.fifo" + }, + "Type": "AWS::SQS::Queue" + }, + "HelloLambdaFunction": { + "DependsOn": [ + "HelloLogGroup" + ], + "Metadata": { + "slicWatch": { + "alarms": { + "Lambda": { + "Invocations": { + "Threshold": 2 } } - ] + } + } + }, + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" }, - "RoleArn": { + "FunctionName": "serverless-test-project-dev-hello", + "Handler": "basic-handler.hello", + "MemorySize": 1024, + "Role": { "Fn::GetAtt": [ - "WorkflowRole", + "IamRoleLambdaExecution", "Arn" ] }, - "LoggingConfiguration": { - "Level": "ALL", - "IncludeExecutionData": true, - "Destinations": [ - { - "CloudWatchLogsLogGroup": { - "LogGroupArn": { - "Fn::GetAtt": [ - "workflowLogGroup", - "Arn" - ] - } - } - } - ] - }, - "StateMachineName": "Workflow" + "Runtime": "nodejs18.x", + "Timeout": 6 }, - "DependsOn": [ - "WorkflowRole" - ] + "Type": "AWS::Lambda::Function" }, - "ExpressWorkflow": { - "Type": "AWS::StepFunctions::StateMachine", + "HelloLambdaVersioncvZrQjYr4FdYsM3CaTj5TKuOJmUjyL07tfIDVXBSw4": { + "DeletionPolicy": "Retain", "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" + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=", + "FunctionName": { + "Ref": "HelloLambdaFunction" + } }, - "DependsOn": [ - "ExpressWorkflowRole" - ] + "Type": "AWS::Lambda::Version" }, - "ApiGatewayRestApi": { - "Type": "AWS::ApiGateway::RestApi", + "HelloLogGroup": { "Properties": { - "Name": "dev-serverless-test-project", - "EndpointConfiguration": { - "Types": [ - "REGIONAL" - ] - }, - "Policy": "" - } + "LogGroupName": "/aws/lambda/serverless-test-project-dev-hello" + }, + "Type": "AWS::Logs::LogGroup" }, - "ApiGatewayResourceItem": { - "Type": "AWS::ApiGateway::Resource", + "HttpGetterLambdaFunction": { + "DependsOn": [ + "HttpGetterLogGroup" + ], + "Metadata": { + "slicWatch": {} + }, "Properties": { - "ParentId": { - "Fn::GetAtt": [ - "ApiGatewayRestApi", - "RootResourceId" - ] + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" }, - "PathPart": "item", - "RestApiId": { - "Ref": "ApiGatewayRestApi" - } - } - }, - "ApiGatewayResourceSubscription": { - "Type": "AWS::ApiGateway::Resource", - "Properties": { - "ParentId": { + "FunctionName": "serverless-test-project-dev-httpGetter", + "Handler": "apigw-handler.handleGet", + "MemorySize": 1024, + "Role": { "Fn::GetAtt": [ - "ApiGatewayRestApi", - "RootResourceId" + "IamRoleLambdaExecution", + "Arn" ] }, - "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" + "Runtime": "nodejs18.x", + "Timeout": 30 }, - "DependsOn": [ - "ApiGatewayMethodItemGet", - "ApiGatewayMethodSubscriptionPost" - ] + "Type": "AWS::Lambda::Function" }, "HttpGetterLambdaPermissionApiGateway": { - "Type": "AWS::Lambda::Permission", "Properties": { + "Action": "lambda:InvokeFunction", "FunctionName": { "Fn::GetAtt": [ "HttpGetterLambdaFunction", "Arn" ] }, - "Action": "lambda:InvokeFunction", "Principal": "apigateway.amazonaws.com", "SourceArn": { "Fn::Join": [ @@ -1051,71 +901,244 @@ exports[`serverless-test-project/tests/snapshot/serverless-test-project-snapshot ] ] } - } + }, + "Type": "AWS::Lambda::Permission" }, - "SubscriptionHandlerLambdaPermissionApiGateway": { - "Type": "AWS::Lambda::Permission", + "HttpGetterLambdaVersionvK2ALwc1DFqBccIyulxoBU3GveALO98nQc2xP94J8": { + "DeletionPolicy": "Retain", "Properties": { + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=", "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" - }, - "/*/*" - ] - ] + "Ref": "HttpGetterLambdaFunction" } - } + }, + "Type": "AWS::Lambda::Version" }, - "StreamProcessorEventSourceMappingKinesisStream": { - "Type": "AWS::Lambda::EventSourceMapping", - "DependsOn": [ - "IamRoleLambdaExecution" - ], + "HttpGetterLogGroup": { "Properties": { - "BatchSize": 10, - "Enabled": true, - "EventSourceArn": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-httpGetter" + }, + "Type": "AWS::Logs::LogGroup" + }, + "IamRoleLambdaExecution": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ], + "Version": "2012-10-17" + }, + "Path": "/", + "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" + ] + } + ] + } + ] + } + } + ], + "RoleName": { + "Fn::Join": [ + "-", + [ + "serverless-test-project", + "dev", + { + "Ref": "AWS::Region" + }, + "lambdaRole" + ] + ] + } + }, + "Type": "AWS::IAM::Role" + }, + "PingLambdaFunction": { + "DependsOn": [ + "PingLogGroup" + ], + "Metadata": { + "slicWatch": { + "dashboard": { + "enabled": false + } + } + }, + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "FunctionName": "serverless-test-project-dev-ping", + "Handler": "basic-handler.hello", + "MemorySize": 1024, + "Role": { "Fn::GetAtt": [ - "stream", + "IamRoleLambdaExecution", "Arn" ] }, + "Runtime": "nodejs18.x", + "Timeout": 6 + }, + "Type": "AWS::Lambda::Function" + }, + "PingLambdaVersionSQcuddhSFqI0xKYCyuQTTJMvwrlKCB77CNQ16xyQ": { + "DeletionPolicy": "Retain", + "Properties": { + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=", "FunctionName": { - "Fn::GetAtt": [ - "StreamProcessorLambdaFunction", - "Arn" + "Ref": "PingLambdaFunction" + } + }, + "Type": "AWS::Lambda::Version" + }, + "PingLogGroup": { + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-ping" + }, + "Type": "AWS::Logs::LogGroup" + }, + "regularQueue": { + "Properties": { + "QueueName": "SomeRegularQueue" + }, + "Type": "AWS::SQS::Queue" + }, + "ServerlessDeploymentBucket": { + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } ] + } + }, + "Type": "AWS::S3::Bucket" + }, + "ServerlessDeploymentBucketPolicy": { + "Properties": { + "Bucket": { + "Ref": "ServerlessDeploymentBucket" }, - "StartingPosition": "LATEST", - "MaximumRetryAttempts": 0 - } + "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 + } + } + } + ] + } + }, + "Type": "AWS::S3::BucketPolicy" }, "ServerlesstestprojectdeveventsRulerule1EventBridgeRule": { - "Type": "AWS::Events::Rule", "Properties": { "EventPattern": { "detail-type": [ @@ -1139,277 +1162,118 @@ exports[`serverless-test-project/tests/snapshot/serverless-test-project-snapshot } } ] - } + }, + "Type": "AWS::Events::Rule" }, - "EventsRuleEventBridgeLambdaPermission1": { - "Type": "AWS::Lambda::Permission", + "slicWatchApi4XXErrorAlarmdevserverlesstestproject": { "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "EventsRuleLambdaFunction", - "Arn" + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "AlarmDescription": { + "Fn::Sub": [ + "API Gateway 4XXError Average for dev-serverless-test-project breaches 0.05", + {} ] }, - "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 + "AlarmName": { + "Fn::Sub": [ + "ApiGW_4XXError_dev-serverless-test-project", + {} + ] }, - "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": [ + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ { - "IndexName": "GSI1", - "ProvisionedThroughput": { - "ReadCapacityUnits": 1, - "WriteCapacityUnits": 1 - }, - "KeySchema": [ - { - "AttributeName": "gsi1pk", - "KeyType": "HASH" - }, - { - "AttributeName": "gsi1sk", - "KeyType": "RANGE" - } - ], - "Projection": { - "NonKeyAttributes": [ - "address" - ], - "ProjectionType": "INCLUDE" - } + "Name": "ApiName", + "Value": "dev-serverless-test-project" } ], - "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" - } + "EvaluationPeriods": 1, + "MetricName": "4XXError", + "Namespace": "AWS/ApiGateway", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 0.05, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "ecsService": { - "Type": "AWS::ECS::Service", + "slicWatchApi5XXErrorAlarmdevserverlesstestproject": { "Properties": { - "ServiceName": "awesome-service", - "Cluster": { - "Ref": "ecsCluster" + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" + ], + "AlarmDescription": { + "Fn::Sub": [ + "API Gateway 5XXError Average for dev-serverless-test-project breaches 0", + {} + ] }, - "DesiredCount": 0, - "LaunchType": "FARGATE", - "TaskDefinition": { - "Ref": "taskDef" + "AlarmName": { + "Fn::Sub": [ + "ApiGW_5XXError_dev-serverless-test-project", + {} + ] }, - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "ENABLED", - "SecurityGroups": [], - "Subnets": [ - { - "Ref": "subnet" - } - ] + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "ApiName", + "Value": "dev-serverless-test-project" } - } - } + ], + "EvaluationPeriods": 1, + "MetricName": "5XXError", + "Namespace": "AWS/ApiGateway", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "taskDef": { - "Type": "AWS::ECS::TaskDefinition", + "slicWatchApiLatencyAlarmdevserverlesstestproject": { "Properties": { - "RequiresCompatibilities": [ - "FARGATE" + "ActionsEnabled": true, + "AlarmActions": [ + "test-topic" ], - "Cpu": 256, - "Memory": 512, - "ContainerDefinitions": [ + "AlarmDescription": { + "Fn::Sub": [ + "API Gateway Latency p99 for dev-serverless-test-project breaches 5000", + {} + ] + }, + "AlarmName": { + "Fn::Sub": [ + "ApiGW_Latency_dev-serverless-test-project", + {} + ] + }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ { - "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 + "Name": "ApiName", + "Value": "dev-serverless-test-project" } ], - "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" - } - } + "EvaluationPeriods": 1, + "ExtendedStatistic": "p99", + "MetricName": "Latency", + "Namespace": "AWS/ApiGateway", + "OKActions": [], + "Period": 60, + "Threshold": 5000, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, "slicWatchDashboard": { - "Type": "AWS::CloudWatch::Dashboard", "Properties": { "DashboardBody": { "Fn::Sub": { @@ -2978,1435 +2842,1571 @@ exports[`serverless-test-project/tests/snapshot/serverless-test-project-snapshot ] } } - } + }, + "Type": "AWS::CloudWatch::Dashboard" }, - "slicWatchLambdaErrorsAlarmHelloLambdaFunction": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchECSCPUAlarmecsService": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Errors_\${HelloLambdaFunction}", + "ECS CPUUtilization for \${ecsService.Name} breaches 90", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Error count for \${HelloLambdaFunction} breaches 0", + "ECS_CPUAlarm_\${ecsService.Name}", {} ] }, - "MetricName": "Errors", - "Namespace": "AWS/Lambda", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "FunctionName", + "Name": "ServiceName", "Value": { - "Ref": "HelloLambdaFunction" + "Fn::GetAtt": [ + "ecsService", + "Name" + ] + } + }, + { + "Name": "ClusterName", + "Value": { + "Ref": "ecsCluster" } } ], - "Statistic": "Sum", - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + "MetricName": "CPUUtilization", + "Namespace": "AWS/ECS", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 90, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaThrottlesAlarmHelloLambdaFunction": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchECSMemoryAlarmecsService": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Throttles_\${HelloLambdaFunction}", + "ECS MemoryUtilization for \${ecsService.Name} breaches 90", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Throttles % for \${HelloLambdaFunction} breaches 0", + "ECS_MemoryAlarm_\${ecsService.Name}", {} ] }, - "Metrics": [ - { - "Id": "throttles_pc", - "Expression": "(throttles / ( throttles + invocations )) * 100", - "Label": "% Throttles", - "ReturnData": true - }, + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ { - "Id": "throttles", - "MetricStat": { - "Metric": { - "Namespace": "AWS/Lambda", - "MetricName": "Throttles", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "HelloLambdaFunction" - } - } - ] - }, - "Period": 60, - "Stat": "Sum" - }, - "ReturnData": false + "Name": "ServiceName", + "Value": { + "Fn::GetAtt": [ + "ecsService", + "Name" + ] + } }, { - "Id": "invocations", - "MetricStat": { - "Metric": { - "Namespace": "AWS/Lambda", - "MetricName": "Invocations", - "Dimensions": [ - { - "Name": "FunctionName", - "Value": { - "Ref": "HelloLambdaFunction" - } - } - ] - }, - "Period": 60, - "Stat": "Sum" - }, - "ReturnData": false + "Name": "ClusterName", + "Value": { + "Ref": "ecsCluster" + } } ], "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 0 - } + "MetricName": "MemoryUtilization", + "Namespace": "AWS/ECS", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 90, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchLambdaDurationAlarmHelloLambdaFunction": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchEventsFailedInvocationsAlarmServerlesstestprojectdeveventsRulerule1EventBridgeRule": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Lambda_Duration_\${HelloLambdaFunction}", + "EventBridge FailedInvocations for \${ServerlesstestprojectdeveventsRulerule1EventBridgeRule} breaches 1", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Max duration for \${HelloLambdaFunction} breaches 95% of timeout (6)", + "Events_FailedInvocations_Alarm_\${ServerlesstestprojectdeveventsRulerule1EventBridgeRule}", {} ] }, - "MetricName": "Duration", - "Namespace": "AWS/Lambda", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "FunctionName", + "Name": "RuleName", "Value": { - "Ref": "HelloLambdaFunction" + "Ref": "ServerlesstestprojectdeveventsRulerule1EventBridgeRule" } } ], - "Statistic": "Maximum", - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Threshold": 5700 - } + "MetricName": "FailedInvocations", + "Namespace": "AWS/Events", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchApi5XXErrorAlarmdevserverlesstestproject": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchEventsThrottledRulesAlarmServerlesstestprojectdeveventsRulerule1EventBridgeRule": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "ApiGW_5XXError_dev-serverless-test-project", + "EventBridge ThrottledRules for \${ServerlesstestprojectdeveventsRulerule1EventBridgeRule} breaches 1", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "API Gateway 5XXError Average for dev-serverless-test-project breaches 0", + "Events_ThrottledRules_Alarm_\${ServerlesstestprojectdeveventsRulerule1EventBridgeRule}", {} ] }, - "MetricName": "5XXError", - "Namespace": "AWS/ApiGateway", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "ApiName", - "Value": "dev-serverless-test-project" + "Name": "RuleName", + "Value": { + "Ref": "ServerlesstestprojectdeveventsRulerule1EventBridgeRule" + } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Average", - "Threshold": 0 - } + "MetricName": "ThrottledRules", + "Namespace": "AWS/Events", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchApi4XXErrorAlarmdevserverlesstestproject": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchGSIReadThrottleEventsAlarmdataTableGSI1": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "ApiGW_4XXError_dev-serverless-test-project", + "DynamoDB Sum for \${dataTable}GSI1 breaches 10", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "API Gateway 4XXError Average for dev-serverless-test-project breaches 0.05", + "DDB_ReadThrottleEvents_Alarm_\${dataTable}GSI1", {} ] }, - "MetricName": "4XXError", - "Namespace": "AWS/ApiGateway", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "ApiName", - "Value": "dev-serverless-test-project" + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + }, + { + "Name": "GlobalSecondaryIndex", + "Value": "GSI1" } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Average", - "Threshold": 0.05 - } + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchApiLatencyAlarmdevserverlesstestproject": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchGSIWriteThrottleEventsAlarmdataTableGSI1": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "ApiGW_Latency_dev-serverless-test-project", + "DynamoDB Sum for \${dataTable}GSI1 breaches 10", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "API Gateway Latency p99 for dev-serverless-test-project breaches 5000", + "DDB_WriteThrottleEvents_Alarm_\${dataTable}GSI1", {} ] }, - "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", + "Name": "TableName", "Value": { - "Ref": "Workflow" + "Ref": "dataTable" } + }, + { + "Name": "GlobalSecondaryIndex", + "Value": "GSI1" } ], - "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", + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 0 - } + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchStatesExecutionsFailedAlarmWorkflow": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchKinesisStreamGetRecordsSuccessAlarmStream": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "MetricName": "ExecutionsFailed", - "Namespace": "AWS/States", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "Workflow" - } - } - ], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "StepFunctions_ExecutionsFailedAlarm_\${Workflow.Name}", + "Kinesis Average GetRecords.Success for \${stream} breaches 1 milliseconds", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "StepFunctions ExecutionsFailed Sum for \${Workflow.Name} breaches 0", + "Kinesis_StreamGetRecordsSuccess_\${stream}", {} ] }, - "Period": 60, + "ComparisonOperator": "LessThanThreshold", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 0 - } + "MetricName": "GetRecords.Success", + "Namespace": "AWS/Kinesis", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchStatesExecutionsTimedOutAlarmWorkflow": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchKinesisStreamIteratorAgeAlarmStream": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "MetricName": "ExecutionsTimedOut", - "Namespace": "AWS/States", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "Workflow" - } - } - ], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "StepFunctions_ExecutionsTimedOutAlarm_\${Workflow.Name}", + "Kinesis Maximum GetRecords.IteratorAgeMilliseconds for \${stream} breaches 10000 milliseconds", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "StepFunctions ExecutionsTimedOut Sum for \${Workflow.Name} breaches 0", + "Kinesis_StreamIteratorAge_\${stream}", {} ] }, - "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", + "Name": "StreamName", "Value": { - "Ref": "ExpressWorkflow" + "Ref": "stream" } } ], - "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 - } + "MetricName": "GetRecords.IteratorAgeMilliseconds", + "Namespace": "AWS/Kinesis", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 10000, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchStatesExecutionsFailedAlarmExpressWorkflow": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchKinesisStreamPutRecordsSuccessAlarmStream": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "MetricName": "ExecutionsFailed", - "Namespace": "AWS/States", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "ExpressWorkflow" - } - } - ], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "StepFunctions_ExecutionsFailedAlarm_\${ExpressWorkflow.Name}", + "Kinesis Average PutRecords.Success for \${stream} breaches 1 milliseconds", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "StepFunctions ExecutionsFailed Sum for \${ExpressWorkflow.Name} breaches 0", + "Kinesis_StreamPutRecordsSuccess_\${stream}", {} ] }, - "Period": 60, + "ComparisonOperator": "LessThanThreshold", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 0 - } + "MetricName": "PutRecords.Success", + "Namespace": "AWS/Kinesis", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchStatesExecutionsTimedOutAlarmExpressWorkflow": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchKinesisStreamPutRecordSuccessAlarmStream": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "MetricName": "ExecutionsTimedOut", - "Namespace": "AWS/States", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "ExpressWorkflow" - } - } - ], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "StepFunctions_ExecutionsTimedOutAlarm_\${ExpressWorkflow.Name}", + "Kinesis Average PutRecord.Success for \${stream} breaches 1 milliseconds", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "StepFunctions ExecutionsTimedOut Sum for \${ExpressWorkflow.Name} breaches 0", + "Kinesis_StreamPutRecordSuccess_\${stream}", {} ] }, - "Period": 60, + "ComparisonOperator": "LessThanThreshold", + "Dimensions": [ + { + "Name": "StreamName", + "Value": { + "Ref": "stream" + } + } + ], "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 0 - } + "MetricName": "PutRecord.Success", + "Namespace": "AWS/Kinesis", + "OKActions": [], + "Period": 60, + "Statistic": "Average", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchTableReadThrottleEventsAlarmdataTable": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchKinesisStreamReadThroughputAlarmStream": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "DDB_ReadThrottleEvents_Alarm_\${dataTable}", + "Kinesis Sum ReadProvisionedThroughputExceeded for \${stream} breaches 0 milliseconds", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "DynamoDB Sum for \${dataTable} breaches 10", + "Kinesis_StreamReadThroughput_\${stream}", {} ] }, - "MetricName": "ReadThrottleEvents", - "Namespace": "AWS/DynamoDB", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "TableName", + "Name": "StreamName", "Value": { - "Ref": "dataTable" + "Ref": "stream" } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", + "MetricName": "ReadProvisionedThroughputExceeded", + "Namespace": "AWS/Kinesis", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 10 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchTableWriteThrottleEventsAlarmdataTable": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchKinesisStreamWriteThroughputAlarmStream": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "DDB_WriteThrottleEvents_Alarm_\${dataTable}", + "Kinesis Sum WriteProvisionedThroughputExceeded for \${stream} breaches 0 milliseconds", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "DynamoDB Sum for \${dataTable} breaches 10", + "Kinesis_StreamWriteThroughput_\${stream}", {} ] }, - "MetricName": "WriteThrottleEvents", - "Namespace": "AWS/DynamoDB", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "TableName", + "Name": "StreamName", "Value": { - "Ref": "dataTable" + "Ref": "stream" } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", + "MetricName": "WriteProvisionedThroughputExceeded", + "Namespace": "AWS/Kinesis", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 10 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchTableUserErrorsAlarmdataTable": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchLambdaDurationAlarmHelloLambdaFunction": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "DDB_UserErrors_Alarm_\${dataTable}", + "Max duration for \${HelloLambdaFunction} breaches 95% of timeout (6)", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "DynamoDB Sum for \${dataTable} breaches 0", + "Lambda_Duration_\${HelloLambdaFunction}", {} ] }, - "MetricName": "UserErrors", - "Namespace": "AWS/DynamoDB", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "TableName", + "Name": "FunctionName", "Value": { - "Ref": "dataTable" + "Ref": "HelloLambdaFunction" } } ], + "EvaluationPeriods": 1, + "MetricName": "Duration", + "Namespace": "AWS/Lambda", + "OKActions": [], "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 0 - } + "Statistic": "Maximum", + "Threshold": 5700, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchTableSystemErrorsAlarmdataTable": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchLambdaErrorsAlarmHelloLambdaFunction": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "DDB_SystemErrors_Alarm_\${dataTable}", + "Error count for \${HelloLambdaFunction} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "DynamoDB Sum for \${dataTable} breaches 0", + "Lambda_Errors_\${HelloLambdaFunction}", {} ] }, - "MetricName": "SystemErrors", - "Namespace": "AWS/DynamoDB", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "TableName", + "Name": "FunctionName", "Value": { - "Ref": "dataTable" + "Ref": "HelloLambdaFunction" } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 0 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchGSIReadThrottleEventsAlarmdataTableGSI1": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchLambdaThrottlesAlarmHelloLambdaFunction": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "DDB_ReadThrottleEvents_Alarm_\${dataTable}GSI1", + "Throttles % for \${HelloLambdaFunction} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "DynamoDB Sum for \${dataTable}GSI1 breaches 10", + "Lambda_Throttles_\${HelloLambdaFunction}", {} ] }, - "MetricName": "ReadThrottleEvents", - "Namespace": "AWS/DynamoDB", - "Dimensions": [ + "ComparisonOperator": "GreaterThanThreshold", + "EvaluationPeriods": 1, + "Metrics": [ { - "Name": "TableName", - "Value": { - "Ref": "dataTable" - } + "Id": "throttles_pc", + "Expression": "(throttles / ( throttles + invocations )) * 100", + "Label": "% Throttles", + "ReturnData": true }, { - "Name": "GlobalSecondaryIndex", - "Value": "GSI1" + "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 } ], - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 10 - } + "OKActions": [], + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchGSIWriteThrottleEventsAlarmdataTableGSI1": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchSNSNumberOfNotificationsFailedAlarmTopic": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "DDB_WriteThrottleEvents_Alarm_\${dataTable}GSI1", + "SNS NumberOfNotificationsFailed for \${topic.TopicName} breaches 1", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "DynamoDB Sum for \${dataTable}GSI1 breaches 10", + "SNS_NumberOfNotificationsFailed_Alarm_\${topic.TopicName}", {} ] }, - "MetricName": "WriteThrottleEvents", - "Namespace": "AWS/DynamoDB", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "TableName", + "Name": "TopicName", "Value": { - "Ref": "dataTable" + "Fn::GetAtt": [ + "topic", + "TopicName" + ] } - }, - { - "Name": "GlobalSecondaryIndex", - "Value": "GSI1" } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", + "MetricName": "NumberOfNotificationsFailed", + "Namespace": "AWS/SNS", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 10 - } + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchKinesisStreamIteratorAgeAlarmStream": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchSNSNumberOfNotificationsFilteredOutInvalidAttributesAlarmTopic": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Kinesis_StreamIteratorAge_\${stream}", + "SNS NumberOfNotificationsFilteredOutInvalidAttributes for \${topic.TopicName} breaches 1", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Kinesis Maximum GetRecords.IteratorAgeMilliseconds for \${stream} breaches 10000 milliseconds", + "SNS_NumberOfNotificationsFilteredOutInvalidAttributes_Alarm_\${topic.TopicName}", {} ] }, - "MetricName": "GetRecords.IteratorAgeMilliseconds", - "Namespace": "AWS/Kinesis", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "StreamName", + "Name": "TopicName", "Value": { - "Ref": "stream" + "Fn::GetAtt": [ + "topic", + "TopicName" + ] } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Maximum", - "Threshold": 10000 - } + "MetricName": "NumberOfNotificationsFilteredOut-InvalidAttributes", + "Namespace": "AWS/SNS", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchKinesisStreamReadThroughputAlarmStream": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchSQSInFlightMsgsAlarmfifoQueue": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Kinesis_StreamReadThroughput_\${stream}", + "SQS in-flight messages for \${fifoQueue.QueueName} breaches 16000 (80% of the hard limit of 20000)", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Kinesis Sum ReadProvisionedThroughputExceeded for \${stream} breaches 0 milliseconds", + "SQS_ApproximateNumberOfMessagesNotVisible_\${fifoQueue.QueueName}", {} ] }, - "MetricName": "ReadProvisionedThroughputExceeded", - "Namespace": "AWS/Kinesis", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "StreamName", + "Name": "QueueName", "Value": { - "Ref": "stream" + "Fn::GetAtt": [ + "fifoQueue", + "QueueName" + ] } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 0 - } + "MetricName": "ApproximateNumberOfMessagesNotVisible", + "Namespace": "AWS/SQS", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 16000, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchKinesisStreamWriteThroughputAlarmStream": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchSQSInFlightMsgsAlarmregularQueue": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Kinesis_StreamWriteThroughput_\${stream}", + "SQS in-flight messages for \${regularQueue.QueueName} breaches 96000 (80% of the hard limit of 120000)", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Kinesis Sum WriteProvisionedThroughputExceeded for \${stream} breaches 0 milliseconds", + "SQS_ApproximateNumberOfMessagesNotVisible_\${regularQueue.QueueName}", {} ] }, - "MetricName": "WriteProvisionedThroughputExceeded", - "Namespace": "AWS/Kinesis", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "StreamName", + "Name": "QueueName", "Value": { - "Ref": "stream" + "Fn::GetAtt": [ + "regularQueue", + "QueueName" + ] } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 0 - } + "MetricName": "ApproximateNumberOfMessagesNotVisible", + "Namespace": "AWS/SQS", + "OKActions": [], + "Period": 60, + "Statistic": "Maximum", + "Threshold": 96000, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchKinesisStreamPutRecordSuccessAlarmStream": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchStatesExecutionsFailedAlarmExpressWorkflow": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Kinesis_StreamPutRecordSuccess_\${stream}", + "StepFunctions ExecutionsFailed Sum for \${ExpressWorkflow.Name} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Kinesis Average PutRecord.Success for \${stream} breaches 1 milliseconds", + "StepFunctions_ExecutionsFailedAlarm_\${ExpressWorkflow.Name}", {} ] }, - "MetricName": "PutRecord.Success", - "Namespace": "AWS/Kinesis", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "StreamName", + "Name": "StateMachineArn", "Value": { - "Ref": "stream" + "Ref": "ExpressWorkflow" } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "LessThanThreshold", - "Statistic": "Average", - "Threshold": 1 - } + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchKinesisStreamPutRecordsSuccessAlarmStream": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchStatesExecutionsFailedAlarmWorkflow": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Kinesis_StreamPutRecordsSuccess_\${stream}", + "StepFunctions ExecutionsFailed Sum for \${Workflow.Name} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Kinesis Average PutRecords.Success for \${stream} breaches 1 milliseconds", + "StepFunctions_ExecutionsFailedAlarm_\${Workflow.Name}", {} ] }, - "MetricName": "PutRecords.Success", - "Namespace": "AWS/Kinesis", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "StreamName", + "Name": "StateMachineArn", "Value": { - "Ref": "stream" + "Ref": "Workflow" } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "LessThanThreshold", - "Statistic": "Average", - "Threshold": 1 - } + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchKinesisStreamGetRecordsSuccessAlarmStream": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchStatesExecutionsTimedOutAlarmExpressWorkflow": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Kinesis_StreamGetRecordsSuccess_\${stream}", + "StepFunctions ExecutionsTimedOut Sum for \${ExpressWorkflow.Name} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "Kinesis Average GetRecords.Success for \${stream} breaches 1 milliseconds", + "StepFunctions_ExecutionsTimedOutAlarm_\${ExpressWorkflow.Name}", {} ] }, - "MetricName": "GetRecords.Success", - "Namespace": "AWS/Kinesis", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "StreamName", + "Name": "StateMachineArn", "Value": { - "Ref": "stream" + "Ref": "ExpressWorkflow" } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "LessThanThreshold", - "Statistic": "Average", - "Threshold": 1 - } + "MetricName": "ExecutionsTimedOut", + "Namespace": "AWS/States", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchSQSInFlightMsgsAlarmregularQueue": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchStatesExecutionsTimedOutAlarmWorkflow": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "SQS_ApproximateNumberOfMessagesNotVisible_\${regularQueue.QueueName}", + "StepFunctions ExecutionsTimedOut Sum for \${Workflow.Name} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "SQS in-flight messages for \${regularQueue.QueueName} breaches 96000 (80% of the hard limit of 120000)", + "StepFunctions_ExecutionsTimedOutAlarm_\${Workflow.Name}", {} ] }, - "MetricName": "ApproximateNumberOfMessagesNotVisible", - "Namespace": "AWS/SQS", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "QueueName", + "Name": "StateMachineArn", "Value": { - "Fn::GetAtt": [ - "regularQueue", - "QueueName" - ] + "Ref": "Workflow" } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Maximum", - "Threshold": 96000 - } + "MetricName": "ExecutionsTimedOut", + "Namespace": "AWS/States", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchSQSInFlightMsgsAlarmfifoQueue": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchStatesExecutionThrottledAlarmExpressWorkflow": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "SQS_ApproximateNumberOfMessagesNotVisible_\${fifoQueue.QueueName}", + "StepFunctions ExecutionThrottled Sum for \${ExpressWorkflow.Name} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "SQS in-flight messages for \${fifoQueue.QueueName} breaches 16000 (80% of the hard limit of 20000)", + "StepFunctions_ExecutionThrottledAlarm_\${ExpressWorkflow.Name}", {} ] }, - "MetricName": "ApproximateNumberOfMessagesNotVisible", - "Namespace": "AWS/SQS", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "QueueName", + "Name": "StateMachineArn", "Value": { - "Fn::GetAtt": [ - "fifoQueue", - "QueueName" - ] + "Ref": "ExpressWorkflow" } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Maximum", - "Threshold": 16000 - } + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchECSMemoryAlarmecsService": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchStatesExecutionThrottledAlarmWorkflow": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "ECS_MemoryAlarm_\${ecsService.Name}", + "StepFunctions ExecutionThrottled Sum for \${Workflow.Name} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "ECS MemoryUtilization for \${ecsService.Name} breaches 90", + "StepFunctions_ExecutionThrottledAlarm_\${Workflow.Name}", {} ] }, - "MetricName": "MemoryUtilization", - "Namespace": "AWS/ECS", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "ServiceName", - "Value": { - "Fn::GetAtt": [ - "ecsService", - "Name" - ] - } - }, - { - "Name": "ClusterName", + "Name": "StateMachineArn", "Value": { - "Ref": "ecsCluster" + "Ref": "Workflow" } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Average", - "Threshold": 90 - } + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchECSCPUAlarmecsService": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchTableReadThrottleEventsAlarmdataTable": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "ECS_CPUAlarm_\${ecsService.Name}", + "DynamoDB Sum for \${dataTable} breaches 10", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "ECS CPUUtilization for \${ecsService.Name} breaches 90", + "DDB_ReadThrottleEvents_Alarm_\${dataTable}", {} ] }, - "MetricName": "CPUUtilization", - "Namespace": "AWS/ECS", + "ComparisonOperator": "GreaterThanThreshold", "Dimensions": [ { - "Name": "ServiceName", - "Value": { - "Fn::GetAtt": [ - "ecsService", - "Name" - ] - } - }, - { - "Name": "ClusterName", + "Name": "TableName", "Value": { - "Ref": "ecsCluster" + "Ref": "dataTable" } } ], - "Period": 60, "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Average", - "Threshold": 90 - } + "MetricName": "ReadThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchSNSNumberOfNotificationsFilteredOutInvalidAttributesAlarmTopic": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchTableSystemErrorsAlarmdataTable": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "MetricName": "NumberOfNotificationsFilteredOut-InvalidAttributes", - "Namespace": "AWS/SNS", - "Dimensions": [ - { - "Name": "TopicName", - "Value": { - "Fn::GetAtt": [ - "topic", - "TopicName" - ] - } - } - ], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "SNS_NumberOfNotificationsFilteredOutInvalidAttributes_Alarm_\${topic.TopicName}", + "DynamoDB Sum for \${dataTable} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "SNS NumberOfNotificationsFilteredOutInvalidAttributes for \${topic.TopicName} breaches 1", + "DDB_SystemErrors_Alarm_\${dataTable}", {} ] }, - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "SystemErrors", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 1 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchSNSNumberOfNotificationsFailedAlarmTopic": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchTableUserErrorsAlarmdataTable": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "MetricName": "NumberOfNotificationsFailed", - "Namespace": "AWS/SNS", - "Dimensions": [ - { - "Name": "TopicName", - "Value": { - "Fn::GetAtt": [ - "topic", - "TopicName" - ] - } - } - ], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "SNS_NumberOfNotificationsFailed_Alarm_\${topic.TopicName}", + "DynamoDB Sum for \${dataTable} breaches 0", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "SNS NumberOfNotificationsFailed for \${topic.TopicName} breaches 1", + "DDB_UserErrors_Alarm_\${dataTable}", {} ] }, - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "TableName", + "Value": { + "Ref": "dataTable" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "UserErrors", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, "Statistic": "Sum", - "Threshold": 1 - } + "Threshold": 0, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" }, - "slicWatchEventsFailedInvocationsAlarmServerlesstestprojectdeveventsRulerule1EventBridgeRule": { - "Type": "AWS::CloudWatch::Alarm", + "slicWatchTableWriteThrottleEventsAlarmdataTable": { "Properties": { "ActionsEnabled": true, "AlarmActions": [ "test-topic" ], - "OKActions": [], - "MetricName": "FailedInvocations", - "Namespace": "AWS/Events", - "Dimensions": [ - { - "Name": "RuleName", - "Value": { - "Ref": "ServerlesstestprojectdeveventsRulerule1EventBridgeRule" - } - } - ], - "AlarmName": { + "AlarmDescription": { "Fn::Sub": [ - "Events_FailedInvocations_Alarm_\${ServerlesstestprojectdeveventsRulerule1EventBridgeRule}", + "DynamoDB Sum for \${dataTable} breaches 10", {} ] }, - "AlarmDescription": { + "AlarmName": { "Fn::Sub": [ - "EventBridge FailedInvocations for \${ServerlesstestprojectdeveventsRulerule1EventBridgeRule} breaches 1", + "DDB_WriteThrottleEvents_Alarm_\${dataTable}", {} ] }, - "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", + "Name": "TableName", "Value": { - "Ref": "ServerlesstestprojectdeveventsRulerule1EventBridgeRule" + "Ref": "dataTable" } } ], - "AlarmName": { - "Fn::Sub": [ - "Events_ThrottledRules_Alarm_\${ServerlesstestprojectdeveventsRulerule1EventBridgeRule}", - {} + "EvaluationPeriods": 1, + "MetricName": "WriteThrottleEvents", + "Namespace": "AWS/DynamoDB", + "OKActions": [], + "Period": 60, + "Statistic": "Sum", + "Threshold": 10, + "TreatMissingData": "notBreaching" + }, + "Type": "AWS::CloudWatch::Alarm" + }, + "stream": { + "Properties": { + "Name": { + "Fn::Sub": "slic-watch-test-project-stream-\${AWS::AccountId}-\${AWS::Region}" + }, + "ShardCount": 1 + }, + "Type": "AWS::Kinesis::Stream" + }, + "StreamProcessorEventSourceMappingKinesisStream": { + "DependsOn": [ + "IamRoleLambdaExecution" + ], + "Properties": { + "BatchSize": 10, + "Enabled": true, + "EventSourceArn": { + "Fn::GetAtt": [ + "stream", + "Arn" ] }, - "AlarmDescription": { - "Fn::Sub": [ - "EventBridge ThrottledRules for \${ServerlesstestprojectdeveventsRulerule1EventBridgeRule} breaches 1", - {} + "FunctionName": { + "Fn::GetAtt": [ + "StreamProcessorLambdaFunction", + "Arn" ] }, - "Period": 60, - "EvaluationPeriods": 1, - "TreatMissingData": "notBreaching", - "ComparisonOperator": "GreaterThanThreshold", - "Statistic": "Sum", - "Threshold": 1 - } - } - }, - "Outputs": { - "ServerlessDeploymentBucketName": { - "Value": { - "Ref": "ServerlessDeploymentBucket" + "MaximumRetryAttempts": 0, + "StartingPosition": "LATEST" }, - "Export": { - "Name": "sls-serverless-test-project-dev-ServerlessDeploymentBucketName" - } + "Type": "AWS::Lambda::EventSourceMapping" }, - "HelloLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "HelloLambdaVersioncvZrQjYr4FdYsM3CaTj5TKuOJmUjyL07tfIDVXBSw4" + "StreamProcessorLambdaFunction": { + "DependsOn": [ + "StreamProcessorLogGroup" + ], + "Metadata": { + "slicWatch": {} }, - "Export": { - "Name": "sls-serverless-test-project-dev-HelloLambdaFunctionQualifiedArn" - } + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "FunctionName": "serverless-test-project-dev-streamProcessor", + "Handler": "stream-handler.handle", + "MemorySize": 1024, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 6 + }, + "Type": "AWS::Lambda::Function" }, - "PingLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "PingLambdaVersionSQcuddhSFqI0xKYCyuQTTJMvwrlKCB77CNQ16xyQ" + "StreamProcessorLambdaVersion24Kwch4oq5ogXKcIDJuLGB1qAJWt8aqgW43aCjKI": { + "DeletionPolicy": "Retain", + "Properties": { + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=", + "FunctionName": { + "Ref": "StreamProcessorLambdaFunction" + } }, - "Export": { - "Name": "sls-serverless-test-project-dev-PingLambdaFunctionQualifiedArn" - } + "Type": "AWS::Lambda::Version" }, - "ThrottlerLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "ThrottlerLambdaVersion0UeWLgxZYywcyV3gGiutpyCQJEbO6Gk8zSSOP7dMEps" + "StreamProcessorLogGroup": { + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-streamProcessor" }, - "Export": { - "Name": "sls-serverless-test-project-dev-ThrottlerLambdaFunctionQualifiedArn" - } + "Type": "AWS::Logs::LogGroup" }, - "DriveStreamLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "DriveStreamLambdaVersionsWkqlV7IV7mJdqIqQToVljMizTzZoDCso7qMazjI" + "subnet": { + "Properties": { + "AvailabilityZone": "eu-west-1a", + "CidrBlock": "10.0.16.0/20", + "VpcId": { + "Ref": "vpc" + } }, - "Export": { - "Name": "sls-serverless-test-project-dev-DriveStreamLambdaFunctionQualifiedArn" - } + "Type": "AWS::EC2::Subnet" }, - "DriveQueueLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "DriveQueueLambdaVersionTmzx8HCxfunJ3etrLOOYLg8zG05MzRauykeVpZFz8WY" + "SubscriptionHandlerLambdaFunction": { + "DependsOn": [ + "SubscriptionHandlerLogGroup" + ], + "Metadata": { + "slicWatch": {} + }, + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "FunctionName": "serverless-test-project-dev-subscriptionHandler", + "Handler": "apigw-handler.handleSubscription", + "MemorySize": 1024, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 30 + }, + "Type": "AWS::Lambda::Function" + }, + "SubscriptionHandlerLambdaPermissionApiGateway": { + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "SubscriptionHandlerLambdaFunction", + "Arn" + ] + }, + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "ApiGatewayRestApi" + }, + "/*/*" + ] + ] + } + }, + "Type": "AWS::Lambda::Permission" + }, + "SubscriptionHandlerLambdaVersion4kKEYaIgWsMN0XYzRQn4VAailfQcZ23kdSSOKepfB4A": { + "DeletionPolicy": "Retain", + "Properties": { + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=", + "FunctionName": { + "Ref": "SubscriptionHandlerLambdaFunction" + } + }, + "Type": "AWS::Lambda::Version" + }, + "SubscriptionHandlerLogGroup": { + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-subscriptionHandler" }, - "Export": { - "Name": "sls-serverless-test-project-dev-DriveQueueLambdaFunctionQualifiedArn" - } + "Type": "AWS::Logs::LogGroup" }, - "DriveTableLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "DriveTableLambdaVersionkqI0DCnUasgza04mnCpqj0q5vePTOojYtyi4hxfE3ME" + "subscriptionTest": { + "Properties": { + "Endpoint": { + "Fn::Sub": "https://\${ApiGatewayRestApi}.execute-api.\${AWS::Region}.amazonaws.com/dev/subscription" + }, + "Protocol": "https", + "TopicArn": { + "Ref": "topic" + } }, - "Export": { - "Name": "sls-serverless-test-project-dev-DriveTableLambdaFunctionQualifiedArn" - } + "Type": "AWS::SNS::Subscription" }, - "StreamProcessorLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "StreamProcessorLambdaVersion24Kwch4oq5ogXKcIDJuLGB1qAJWt8aqgW43aCjKI" + "taskDef": { + "Properties": { + "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 + } + ], + "Cpu": 256, + "Memory": 512, + "NetworkMode": "awsvpc", + "RequiresCompatibilities": [ + "FARGATE" + ] }, - "Export": { - "Name": "sls-serverless-test-project-dev-StreamProcessorLambdaFunctionQualifiedArn" - } + "Type": "AWS::ECS::TaskDefinition" }, - "HttpGetterLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "HttpGetterLambdaVersionvK2ALwc1DFqBccIyulxoBU3GveALO98nQc2xP94J8" + "ThrottlerLambdaFunction": { + "DependsOn": [ + "ThrottlerLogGroup" + ], + "Metadata": { + "slicWatch": {} }, - "Export": { - "Name": "sls-serverless-test-project-dev-HttpGetterLambdaFunctionQualifiedArn" - } + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/serverless-test-project/dev/1701242216679-2023-11-29T07:16:56.679Z/serverless-test-project.zip" + }, + "FunctionName": "serverless-test-project-dev-throttler", + "Handler": "basic-handler.hello", + "MemorySize": 1024, + "ReservedConcurrentExecutions": 0, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 6 + }, + "Type": "AWS::Lambda::Function" }, - "SubscriptionHandlerLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "SubscriptionHandlerLambdaVersion4kKEYaIgWsMN0XYzRQn4VAailfQcZ23kdSSOKepfB4A" + "ThrottlerLambdaVersion0UeWLgxZYywcyV3gGiutpyCQJEbO6Gk8zSSOP7dMEps": { + "DeletionPolicy": "Retain", + "Properties": { + "CodeSha256": "8+6CAXAhHnCOtQPN1A6d4fRjjFV13css2+2nirSNse0=", + "FunctionName": { + "Ref": "ThrottlerLambdaFunction" + } }, - "Export": { - "Name": "sls-serverless-test-project-dev-SubscriptionHandlerLambdaFunctionQualifiedArn" - } + "Type": "AWS::Lambda::Version" }, - "EventsRuleLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "EventsRuleLambdaVersionxBuN447jfeozyKD2CEV3oCIHhShTUOVe5XKOkBlbchQ" + "ThrottlerLogGroup": { + "Properties": { + "LogGroupName": "/aws/lambda/serverless-test-project-dev-throttler" }, - "Export": { - "Name": "sls-serverless-test-project-dev-EventsRuleLambdaFunctionQualifiedArn" - } + "Type": "AWS::Logs::LogGroup" }, - "WorkflowArn": { - "Description": "Current StateMachine Arn", - "Value": { - "Ref": "Workflow" + "topic": { + "Properties": { + "TopicName": { + "Fn::Sub": "slic-watch-test-project-topic-\${AWS::AccountId}-\${AWS::Region}" + } }, - "Export": { - "Name": "sls-serverless-test-project-dev-WorkflowArn" - } + "Type": "AWS::SNS::Topic" }, - "ExpressWorkflowArn": { - "Description": "Current StateMachine Arn", - "Value": { - "Ref": "ExpressWorkflow" + "vpc": { + "Properties": { + "CidrBlock": "10.0.0.0/16" }, - "Export": { - "Name": "sls-serverless-test-project-dev-ExpressWorkflowArn" - } + "Type": "AWS::EC2::VPC" }, - "ServiceEndpoint": { - "Description": "URL of the service endpoint", - "Value": { - "Fn::Join": [ - "", - [ - "https://", - { - "Ref": "ApiGatewayRestApi" - }, - ".execute-api.", + "Workflow": { + "DependsOn": [ + "WorkflowRole" + ], + "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}", { - "Ref": "AWS::Region" - }, - ".", + "085edd942ce144c5bd80364a6e973e4d": { + "Fn::GetAtt": [ + "PingLambdaFunction", + "Arn" + ] + } + } + ] + }, + "LoggingConfiguration": { + "Destinations": [ { - "Ref": "AWS::URLSuffix" - }, - "/dev" + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "workflowLogGroup", + "Arn" + ] + } + } + } + ], + "IncludeExecutionData": true, + "Level": "ALL" + }, + "RoleArn": { + "Fn::GetAtt": [ + "WorkflowRole", + "Arn" ] + }, + "StateMachineName": "Workflow" + }, + "Type": "AWS::StepFunctions::StateMachine" + }, + "workflowLogGroup": { + "Properties": { + "LogGroupName": "WorkflowLogs", + "RetentionInDays": 1 + }, + "Type": "AWS::Logs::LogGroup" + }, + "WorkflowRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Sub": "states.\${AWS::Region}.amazonaws.com" + } + }, + "Action": "sts:AssumeRole" + } + ], + "Version": "2012-10-17" + }, + "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": "*" + } + ] + } + } ] }, - "Export": { - "Name": "sls-serverless-test-project-dev-ServiceEndpoint" - } + "Type": "AWS::IAM::Role" } } } diff --git a/test-utils/sls-test-utils.ts b/test-utils/sls-test-utils.ts index 197b6e93..a6a7c237 100644 --- a/test-utils/sls-test-utils.ts +++ b/test-utils/sls-test-utils.ts @@ -5,7 +5,7 @@ import pino from 'pino' const extras = ['levels', 'silent', 'onChild', 'trace', 'debug', 'info', 'warn', 'error', 'fatal'] const pinoLogger = pino() export const dummyLogger = Object.fromEntries( - Object.entries(pinoLogger).filter(([key]) => !extras.includes(key)) + Object.entries(pinoLogger).filter(([key]) => !extras.includes(key as string)) ) export const pluginUtils = { log: dummyLogger } diff --git a/test-utils/snapshot-utils.ts b/test-utils/snapshot-utils.ts index d1f403ec..defd3520 100644 --- a/test-utils/snapshot-utils.ts +++ b/test-utils/snapshot-utils.ts @@ -11,7 +11,23 @@ import { type Test } from 'tap' * @returns The formatted snapshot */ export function formatSnapshot (template: Template): string { - return JSON.stringify(template, null, ' ') + return JSON.stringify(sortObject(template), null, ' ') +} + +/** + * Create a copy of the object with every nested property sorted alphabetically for easier comparison + */ +export function sortObject (obj: object): object { + const sortedObj: Record = {} + for (const [key, value] of Object.entries(obj).toSorted(([a], [b]) => (a as string).localeCompare(b as string))) { + if (typeof value === 'object' && value !== null && !Array.isArray(value)) { + const obj = value as any + sortedObj[key] = sortObject(typeof obj.toJSON === 'function' ? obj.toJSON() : obj) + } else { + sortedObj[key] = value + } + } + return sortedObj as object } /** @@ -27,7 +43,7 @@ export function cleanSnapshot (snapshot: string): string { ([key, value]) => { const resource = value if (resource.Type === 'AWS::CloudWatch::Dashboard') { - const dashBody = (resource.Properties as DashboardProperties).DashboardBody + const dashBody = (resource.Properties as DashboardProperties).DashboardBody as any const subValue = dashBody['Fn::Sub'] const parsedValue = JSON.parse(subValue) return [key, {