Skip to content

Commit

Permalink
Regenerate test template and tidy up README and ymls
Browse files Browse the repository at this point in the history
  • Loading branch information
eoinsha committed May 20, 2022
1 parent fcbc3b3 commit 9afaa7b
Show file tree
Hide file tree
Showing 5 changed files with 249 additions and 260 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SLIC Watch provides a CloudWatch Dashboard and Alarms for:
4. Kinesis Data Streams
5. SQS Queues
6. Step Functions
7. ECS on Fargate
7. ECS (Fargate or EC2)

Currently, SLIC Watch is available as a Serverless Framework plugin. Serverless Framework v2 and v3 are supported.

Expand Down Expand Up @@ -139,6 +139,12 @@ The dashboard contains one widget per Step Function:
|--|
|![Step Function widget](https://raw.githubusercontent.com/fourtheorem/slic-watch/main/docs/stepFunctions.png)

### ECS / Fargate

ECS alarms are created for Fargate or EC2 clusters:
1. Memory Utilization
2. CPU Utilization

## Configuration

Configuration is entirely optional - SLIC Watch provides defaults that work out of the box.
Expand Down Expand Up @@ -253,6 +259,13 @@ custom:
InFlightMessagesPc:
Statistic: Maximum
Threshold: 80 # 80% of 120.000 for regular queues or 80% of 20000 for FIFO queues
ECS:
MemoryUtilization:
Statistic: Average
Threshold: 90
CPUUtilization:
Statistic: Average
Threshold: 90

dashboard:
enabled: true
Expand Down Expand Up @@ -328,6 +341,11 @@ custom:
Statistic: ["Maximum"]
ApproximateNumberOfMessagesVisible:
Statistic: ["Maximum"]
ECS:
MemoryUtilization:
Statistic: ["Average"]
CPUUtilization:
Statistic: ["Average"]
```
An example project is provided for reference: [serverless-test-project](./serverless-test-project)
Expand Down
125 changes: 91 additions & 34 deletions serverless-plugin/tests/resources/cloudformation-template-stack.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
"S3Bucket": {
"Ref": "ServerlessDeploymentBucket"
},
"S3Key": "serverless/serverless-test-project/dev/1652971024918-2022-05-19T14:37:04.918Z/serverless-test-project.zip"
"S3Key": "serverless/serverless-test-project/dev/1653074572190-2022-05-20T19:22:52.190Z/serverless-test-project.zip"
},
"Handler": "basic-handler.hello",
"Runtime": "nodejs12.x",
Expand All @@ -245,7 +245,7 @@
"S3Bucket": {
"Ref": "ServerlessDeploymentBucket"
},
"S3Key": "serverless/serverless-test-project/dev/1652971024918-2022-05-19T14:37:04.918Z/serverless-test-project.zip"
"S3Key": "serverless/serverless-test-project/dev/1653074572190-2022-05-20T19:22:52.190Z/serverless-test-project.zip"
},
"Handler": "basic-handler.hello",
"Runtime": "nodejs12.x",
Expand All @@ -270,7 +270,7 @@
"S3Bucket": {
"Ref": "ServerlessDeploymentBucket"
},
"S3Key": "serverless/serverless-test-project/dev/1652971024918-2022-05-19T14:37:04.918Z/serverless-test-project.zip"
"S3Key": "serverless/serverless-test-project/dev/1653074572190-2022-05-20T19:22:52.190Z/serverless-test-project.zip"
},
"Handler": "basic-handler.hello",
"Runtime": "nodejs12.x",
Expand All @@ -296,7 +296,7 @@
"S3Bucket": {
"Ref": "ServerlessDeploymentBucket"
},
"S3Key": "serverless/serverless-test-project/dev/1652971024918-2022-05-19T14:37:04.918Z/serverless-test-project.zip"
"S3Key": "serverless/serverless-test-project/dev/1653074572190-2022-05-20T19:22:52.190Z/serverless-test-project.zip"
},
"Handler": "stream-test-handler.handleDrive",
"Runtime": "nodejs12.x",
Expand Down Expand Up @@ -328,7 +328,7 @@
"S3Bucket": {
"Ref": "ServerlessDeploymentBucket"
},
"S3Key": "serverless/serverless-test-project/dev/1652971024918-2022-05-19T14:37:04.918Z/serverless-test-project.zip"
"S3Key": "serverless/serverless-test-project/dev/1653074572190-2022-05-20T19:22:52.190Z/serverless-test-project.zip"
},
"Handler": "queue-test-handler.handleDrive",
"Runtime": "nodejs12.x",
Expand All @@ -353,7 +353,7 @@
"S3Bucket": {
"Ref": "ServerlessDeploymentBucket"
},
"S3Key": "serverless/serverless-test-project/dev/1652971024918-2022-05-19T14:37:04.918Z/serverless-test-project.zip"
"S3Key": "serverless/serverless-test-project/dev/1653074572190-2022-05-20T19:22:52.190Z/serverless-test-project.zip"
},
"Handler": "table-test-hander.handleDrive",
"Runtime": "nodejs12.x",
Expand All @@ -378,7 +378,7 @@
"S3Bucket": {
"Ref": "ServerlessDeploymentBucket"
},
"S3Key": "serverless/serverless-test-project/dev/1652971024918-2022-05-19T14:37:04.918Z/serverless-test-project.zip"
"S3Key": "serverless/serverless-test-project/dev/1653074572190-2022-05-20T19:22:52.190Z/serverless-test-project.zip"
},
"Handler": "stream-handler.handle",
"Runtime": "nodejs12.x",
Expand All @@ -403,7 +403,7 @@
"S3Bucket": {
"Ref": "ServerlessDeploymentBucket"
},
"S3Key": "serverless/serverless-test-project/dev/1652971024918-2022-05-19T14:37:04.918Z/serverless-test-project.zip"
"S3Key": "serverless/serverless-test-project/dev/1653074572190-2022-05-20T19:22:52.190Z/serverless-test-project.zip"
},
"Handler": "apigw-handler.handleGet",
"Runtime": "nodejs12.x",
Expand All @@ -421,84 +421,84 @@
"HttpGetterLogGroup"
]
},
"HelloLambdaVersionHKXJuXgeYK24V0jAKRC7KaQUIARaC0kev5TAPmRBOM": {
"HelloLambdaVersion722UxcHK84FtzQksFJLgO33214XN092rFeZxfBAWMI": {
"Type": "AWS::Lambda::Version",
"DeletionPolicy": "Retain",
"Properties": {
"FunctionName": {
"Ref": "HelloLambdaFunction"
},
"CodeSha256": "ioyXQRkX35upN27acK2lHIXf6rzydwQyWyC+WjYATl8="
"CodeSha256": "FiQzGCDK0fxVWHwCwOVhJmiILUfHAGFpReDupCZm4IY="
}
},
"PingLambdaVersionivrf6dIZWzXv8jGaqqossToBBai1QiV7kuefBNU0Xc": {
"PingLambdaVersionkRCLggFwidyGPubIpsDG3Bz131vjOVNlzKj7NBM8UgE": {
"Type": "AWS::Lambda::Version",
"DeletionPolicy": "Retain",
"Properties": {
"FunctionName": {
"Ref": "PingLambdaFunction"
},
"CodeSha256": "ioyXQRkX35upN27acK2lHIXf6rzydwQyWyC+WjYATl8="
"CodeSha256": "FiQzGCDK0fxVWHwCwOVhJmiILUfHAGFpReDupCZm4IY="
}
},
"ThrottlerLambdaVersionWHo4eySHjExzIm6sn8tyhX4tUxNvoM2vTi8SEMEjK0": {
"ThrottlerLambdaVersionl91cFljDzhpqWXdQeA2t4nCL4O8S6eewBytew6LYg": {
"Type": "AWS::Lambda::Version",
"DeletionPolicy": "Retain",
"Properties": {
"FunctionName": {
"Ref": "ThrottlerLambdaFunction"
},
"CodeSha256": "ioyXQRkX35upN27acK2lHIXf6rzydwQyWyC+WjYATl8="
"CodeSha256": "FiQzGCDK0fxVWHwCwOVhJmiILUfHAGFpReDupCZm4IY="
}
},
"DriveStreamLambdaVersion8BINjBgQgQLwrsojAUC2l9zsiEkFaTbLzqD81toJd8": {
"DriveStreamLambdaVersionZym9I4CW26PuJ2g26SXA4zCtxJm3jUEOzGB9JSpCIA": {
"Type": "AWS::Lambda::Version",
"DeletionPolicy": "Retain",
"Properties": {
"FunctionName": {
"Ref": "DriveStreamLambdaFunction"
},
"CodeSha256": "ioyXQRkX35upN27acK2lHIXf6rzydwQyWyC+WjYATl8="
"CodeSha256": "FiQzGCDK0fxVWHwCwOVhJmiILUfHAGFpReDupCZm4IY="
}
},
"DriveQueueLambdaVersionnQWkvsurMZfdbvJ5JQ800smP3XYTdNjQ56nH5N6Pzg": {
"DriveQueueLambdaVersionqxLBmX6bkW9KfIv3nK7Euv6IWU2k1LNIfruRKLQ": {
"Type": "AWS::Lambda::Version",
"DeletionPolicy": "Retain",
"Properties": {
"FunctionName": {
"Ref": "DriveQueueLambdaFunction"
},
"CodeSha256": "ioyXQRkX35upN27acK2lHIXf6rzydwQyWyC+WjYATl8="
"CodeSha256": "FiQzGCDK0fxVWHwCwOVhJmiILUfHAGFpReDupCZm4IY="
}
},
"DriveTableLambdaVersionAsgfm3jPQKIicJD2Tsu4qH5VqW5K5yi5nmq2tk4Po": {
"DriveTableLambdaVersionmshp4vuCFXIuqNxokV8OQhvrXhDNTcfJirpkqQC5PM": {
"Type": "AWS::Lambda::Version",
"DeletionPolicy": "Retain",
"Properties": {
"FunctionName": {
"Ref": "DriveTableLambdaFunction"
},
"CodeSha256": "ioyXQRkX35upN27acK2lHIXf6rzydwQyWyC+WjYATl8="
"CodeSha256": "FiQzGCDK0fxVWHwCwOVhJmiILUfHAGFpReDupCZm4IY="
}
},
"StreamProcessorLambdaVersionyMKRoNaY0699T5oh5ae9YBYHvESiBHITGCLSPHGaLdk": {
"StreamProcessorLambdaVersionwlUSF2MKmypdz7S8ASUEQJniFQJWYRU4J5ElG6ncY": {
"Type": "AWS::Lambda::Version",
"DeletionPolicy": "Retain",
"Properties": {
"FunctionName": {
"Ref": "StreamProcessorLambdaFunction"
},
"CodeSha256": "ioyXQRkX35upN27acK2lHIXf6rzydwQyWyC+WjYATl8="
"CodeSha256": "FiQzGCDK0fxVWHwCwOVhJmiILUfHAGFpReDupCZm4IY="
}
},
"HttpGetterLambdaVersionyoyVGg99BR9qEwqfluEa261oLc1Hp5uhkAHD24QxI": {
"HttpGetterLambdaVersion8bkTDhhXsi9cMBh96OfTi3WanBalxcwLoE8XqtXkHcc": {
"Type": "AWS::Lambda::Version",
"DeletionPolicy": "Retain",
"Properties": {
"FunctionName": {
"Ref": "HttpGetterLambdaFunction"
},
"CodeSha256": "ioyXQRkX35upN27acK2lHIXf6rzydwQyWyC+WjYATl8="
"CodeSha256": "FiQzGCDK0fxVWHwCwOVhJmiILUfHAGFpReDupCZm4IY="
}
},
"WorkflowRole": {
Expand Down Expand Up @@ -803,7 +803,7 @@
"HttpGetterLambdaPermissionApiGateway"
]
},
"ApiGatewayDeployment1652971020829": {
"ApiGatewayDeployment1653074568829": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"RestApiId": {
Expand Down Expand Up @@ -1005,6 +1005,22 @@
"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": {
Expand All @@ -1019,7 +1035,48 @@
"Ref": "ecsCluster"
},
"DesiredCount": 0,
"LaunchType": "FARGATE"
"LaunchType": "FARGATE",
"TaskDefinition": {
"Ref": "taskDef"
},
"NetworkConfiguration": {
"AwsvpcConfiguration": {
"AssignPublicIp": "ENABLED",
"SecurityGroups": [],
"Subnets": [
{
"Ref": "subnet"
}
]
}
}
}
},
"taskDef": {
"Type": "AWS::ECS::TaskDefinition",
"Properties": {
"RequiresCompatibilities": [
"FARGATE"
],
"Cpu": 256,
"Memory": 512,
"ContainerDefinitions": [
{
"Name": "busybox",
"Image": "busybox",
"Cpu": 256,
"EntryPoint": [
"sh",
"-c"
],
"Memory": 512,
"Command": [
"/bin/sh -c \"while true; do echo Hello; sleep 10; done\""
],
"Essential": true
}
],
"NetworkMode": "awsvpc"
}
}
},
Expand All @@ -1035,7 +1092,7 @@
"HelloLambdaFunctionQualifiedArn": {
"Description": "Current Lambda function version",
"Value": {
"Ref": "HelloLambdaVersionHKXJuXgeYK24V0jAKRC7KaQUIARaC0kev5TAPmRBOM"
"Ref": "HelloLambdaVersion722UxcHK84FtzQksFJLgO33214XN092rFeZxfBAWMI"
},
"Export": {
"Name": "sls-serverless-test-project-dev-HelloLambdaFunctionQualifiedArn"
Expand All @@ -1044,7 +1101,7 @@
"PingLambdaFunctionQualifiedArn": {
"Description": "Current Lambda function version",
"Value": {
"Ref": "PingLambdaVersionivrf6dIZWzXv8jGaqqossToBBai1QiV7kuefBNU0Xc"
"Ref": "PingLambdaVersionkRCLggFwidyGPubIpsDG3Bz131vjOVNlzKj7NBM8UgE"
},
"Export": {
"Name": "sls-serverless-test-project-dev-PingLambdaFunctionQualifiedArn"
Expand All @@ -1053,7 +1110,7 @@
"ThrottlerLambdaFunctionQualifiedArn": {
"Description": "Current Lambda function version",
"Value": {
"Ref": "ThrottlerLambdaVersionWHo4eySHjExzIm6sn8tyhX4tUxNvoM2vTi8SEMEjK0"
"Ref": "ThrottlerLambdaVersionl91cFljDzhpqWXdQeA2t4nCL4O8S6eewBytew6LYg"
},
"Export": {
"Name": "sls-serverless-test-project-dev-ThrottlerLambdaFunctionQualifiedArn"
Expand All @@ -1062,7 +1119,7 @@
"DriveStreamLambdaFunctionQualifiedArn": {
"Description": "Current Lambda function version",
"Value": {
"Ref": "DriveStreamLambdaVersion8BINjBgQgQLwrsojAUC2l9zsiEkFaTbLzqD81toJd8"
"Ref": "DriveStreamLambdaVersionZym9I4CW26PuJ2g26SXA4zCtxJm3jUEOzGB9JSpCIA"
},
"Export": {
"Name": "sls-serverless-test-project-dev-DriveStreamLambdaFunctionQualifiedArn"
Expand All @@ -1071,7 +1128,7 @@
"DriveQueueLambdaFunctionQualifiedArn": {
"Description": "Current Lambda function version",
"Value": {
"Ref": "DriveQueueLambdaVersionnQWkvsurMZfdbvJ5JQ800smP3XYTdNjQ56nH5N6Pzg"
"Ref": "DriveQueueLambdaVersionqxLBmX6bkW9KfIv3nK7Euv6IWU2k1LNIfruRKLQ"
},
"Export": {
"Name": "sls-serverless-test-project-dev-DriveQueueLambdaFunctionQualifiedArn"
Expand All @@ -1080,7 +1137,7 @@
"DriveTableLambdaFunctionQualifiedArn": {
"Description": "Current Lambda function version",
"Value": {
"Ref": "DriveTableLambdaVersionAsgfm3jPQKIicJD2Tsu4qH5VqW5K5yi5nmq2tk4Po"
"Ref": "DriveTableLambdaVersionmshp4vuCFXIuqNxokV8OQhvrXhDNTcfJirpkqQC5PM"
},
"Export": {
"Name": "sls-serverless-test-project-dev-DriveTableLambdaFunctionQualifiedArn"
Expand All @@ -1089,7 +1146,7 @@
"StreamProcessorLambdaFunctionQualifiedArn": {
"Description": "Current Lambda function version",
"Value": {
"Ref": "StreamProcessorLambdaVersionyMKRoNaY0699T5oh5ae9YBYHvESiBHITGCLSPHGaLdk"
"Ref": "StreamProcessorLambdaVersionwlUSF2MKmypdz7S8ASUEQJniFQJWYRU4J5ElG6ncY"
},
"Export": {
"Name": "sls-serverless-test-project-dev-StreamProcessorLambdaFunctionQualifiedArn"
Expand All @@ -1098,7 +1155,7 @@
"HttpGetterLambdaFunctionQualifiedArn": {
"Description": "Current Lambda function version",
"Value": {
"Ref": "HttpGetterLambdaVersionyoyVGg99BR9qEwqfluEa261oLc1Hp5uhkAHD24QxI"
"Ref": "HttpGetterLambdaVersion8bkTDhhXsi9cMBh96OfTi3WanBalxcwLoE8XqtXkHcc"
},
"Export": {
"Name": "sls-serverless-test-project-dev-HttpGetterLambdaFunctionQualifiedArn"
Expand Down
Loading

0 comments on commit 9afaa7b

Please sign in to comment.