Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cloudwatch-actions): support alarm lambda action #28484

Merged
merged 32 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7429bca
feat: cloudwatch alarm lambda action
neilkuan Dec 24, 2023
07f3987
chore: add testing
neilkuan Dec 24, 2023
a347097
chore: update code
neilkuan Jan 1, 2024
0fefaed
chore: add integ testing
neilkuan Jan 1, 2024
b895833
feat: cloudwatch alarm lambda action
neilkuan Dec 24, 2023
6cbfe8b
chore: add testing
neilkuan Dec 24, 2023
3756913
chore: update code
neilkuan Jan 1, 2024
d2e6e06
chore: add integ testing
neilkuan Jan 1, 2024
3403cfb
Merge branch 'support-cloudwatch-alarm-lambda-action' of https://gith…
neilkuan Jan 1, 2024
e8b5869
Merge branch 'main' into support-cloudwatch-alarm-lambda-action
kaizencc Jan 2, 2024
ad2939b
chore: update readme
neilkuan Jan 3, 2024
b8c33eb
chore: update readme
neilkuan Jan 3, 2024
dfb285f
Merge branch 'main' into support-cloudwatch-alarm-lambda-action
neilkuan Jan 3, 2024
83ff289
Merge branch 'main' into support-cloudwatch-alarm-lambda-action
neilkuan Jan 4, 2024
3a3e5b1
chore: update code from pr review
neilkuan Jan 4, 2024
6e5d592
chore: update snapshot
neilkuan Jan 4, 2024
17ec0a2
chore: update integ testing snapshot
neilkuan Jan 4, 2024
adced0d
Merge branch 'main' into support-cloudwatch-alarm-lambda-action
neilkuan Jan 4, 2024
3c5dea5
chore: let testing happy
neilkuan Jan 4, 2024
579c88b
chore: run integ test
neilkuan Jan 4, 2024
d8bde8a
update snapshots
pahud Jan 4, 2024
e634b2f
Merge branch 'support-cloudwatch-alarm-lambda-action' of https://gith…
pahud Jan 4, 2024
d8aded1
chore: update testing and comment
neilkuan Jan 4, 2024
b20de81
chore: let testing happy
neilkuan Jan 4, 2024
dc13eec
chore: typo
neilkuan Jan 4, 2024
ce176dc
Merge branch 'main' into support-cloudwatch-alarm-lambda-action
neilkuan Jan 4, 2024
36f0b15
Small grammar change
paulhcsun Jan 11, 2024
c7468ee
Small grammar change
paulhcsun Jan 11, 2024
d4c760f
chore: add description for lambda alias and version
neilkuan Jan 11, 2024
fb79f07
Merge branch 'main' into support-cloudwatch-alarm-lambda-action
neilkuan Jan 11, 2024
d876c52
Merge branch 'main' into support-cloudwatch-alarm-lambda-action
neilkuan Jan 11, 2024
7aec9fe
Merge branch 'main' into support-cloudwatch-alarm-lambda-action
paulhcsun Jan 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
{
"Resources": {
"inAlarmLambdaServiceRole970DE64C": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
}
]
}
},
"inAlarmLambda0920D101": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"ZipFile": "exports.handler = function handler(event, _context, callback) {\n console.log(JSON.stringify(event, undefined, 2));\n return callback();\n}"
},
"FunctionName": "inAlarmLambda",
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"inAlarmLambdaServiceRole970DE64C",
"Arn"
]
},
"Runtime": "nodejs18.x"
},
"DependsOn": [
"inAlarmLambdaServiceRole970DE64C"
]
},
"Alarm7103F465": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"ActionsEnabled": true,
"AlarmActions": [
{
"Ref": "alarmLambdaCurrentVersionBDCE825C61967a018dfe55c69152d31b6e7ab40b"
},
{
"Ref": "alarmLambdaAliasaliasName41B27313"
},
{
"Fn::GetAtt": [
"alarmLambda131DB691",
"Arn"
]
}
],
"ComparisonOperator": "GreaterThanThreshold",
"Dimensions": [
{
"Name": "FunctionName",
"Value": {
"Ref": "inAlarmLambda0920D101"
}
}
],
"EvaluationPeriods": 1,
"MetricName": "Errors",
"Namespace": "AWS/Lambda",
"Period": 60,
"Statistic": "Sum",
"Threshold": 1,
"TreatMissingData": "notBreaching"
}
},
"alarmLambdaServiceRoleCDAABB9D": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
}
]
}
},
"alarmLambda131DB691": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"ZipFile": "exports.handler = function handler(event, _context, callback) {\n console.log(JSON.stringify(event, undefined, 2));\n return callback();\n}"
},
"FunctionName": "alarmLambda",
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"alarmLambdaServiceRoleCDAABB9D",
"Arn"
]
},
"Runtime": "nodejs18.x"
},
"DependsOn": [
"alarmLambdaServiceRoleCDAABB9D"
]
},
"alarmLambdaCurrentVersionBDCE825C61967a018dfe55c69152d31b6e7ab40b": {
"Type": "AWS::Lambda::Version",
"Properties": {
"FunctionName": {
"Ref": "alarmLambda131DB691"
}
}
},
"alarmLambdaCurrentVersionAlarmPermissionFEBD056F": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"Action": "lambda:InvokeFunction",
"FunctionName": {
"Ref": "alarmLambdaCurrentVersionBDCE825C61967a018dfe55c69152d31b6e7ab40b"
},
"Principal": "lambda.alarms.cloudwatch.amazonaws.com",
"SourceAccount": {
"Ref": "AWS::AccountId"
},
"SourceArn": {
"Fn::GetAtt": [
"Alarm7103F465",
"Arn"
]
}
}
},
"alarmLambdaAliasaliasName41B27313": {
"Type": "AWS::Lambda::Alias",
"Properties": {
"FunctionName": {
"Ref": "alarmLambda131DB691"
},
"FunctionVersion": {
"Fn::GetAtt": [
"alarmLambdaCurrentVersionBDCE825C61967a018dfe55c69152d31b6e7ab40b",
"Version"
]
},
"Name": "aliasName"
}
},
"alarmLambdaAliasaliasNameAlarmPermission64A91652": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"Action": "lambda:InvokeFunction",
"FunctionName": {
"Ref": "alarmLambdaAliasaliasName41B27313"
},
"Principal": "lambda.alarms.cloudwatch.amazonaws.com",
"SourceAccount": {
"Ref": "AWS::AccountId"
},
"SourceArn": {
"Fn::GetAtt": [
"Alarm7103F465",
"Arn"
]
}
}
},
"alarmLambdaAlarmPermission43E41C89": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"Action": "lambda:InvokeFunction",
"FunctionName": {
"Fn::GetAtt": [
"alarmLambda131DB691",
"Arn"
]
},
"Principal": "lambda.alarms.cloudwatch.amazonaws.com",
"SourceAccount": {
"Ref": "AWS::AccountId"
},
"SourceArn": {
"Fn::GetAtt": [
"Alarm7103F465",
"Arn"
]
}
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"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."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading