Skip to content

Instantly share code, notes, and snippets.

@yossale
Created June 21, 2020 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yossale/ccf046258978e7d0a62b79a24bcddeb8 to your computer and use it in GitHub Desktop.
Save yossale/ccf046258978e7d0a62b79a24bcddeb8 to your computer and use it in GitHub Desktop.
Log Group listener
{
"AWSTemplateFormatVersion":"2010-09-09",
"Transform":"AWS::Serverless-2016-10-31",
"Resources":{
"StackUpdatesListener01":{
"Type":"AWS::Serverless::Function",
"Properties":{
"InlineCode": "module.exports.handler = async (event, context) => { console.log('LOGGING', context); return { statusCode: 200 } }",
"Handler": "index.handler",
"Runtime":"nodejs12.x",
"MemorySize":512,
"Timeout":10,
"Environment":{
"Variables":{
"DESTINATION_ARN":""
}
},
"Events":{
"SubscribeEvent":{
"Type":"CloudWatchEvent",
"Properties": {
"Pattern": {
"source":[
"aws.logs"
],
"detail-type":[
"AWS API Call via CloudTrail"
],
"detail": {
"eventSource": [
"logs.amazonaws.com"
],
"eventName":[
"CreateLogGroup"
]
}
}
}
}
},
"Policies":[
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":[
"logs:PutSubscriptionFilter",
"logs:ListTagsLogGroup"
],
"Resource":"*"
},
{
"Effect":"Allow",
"Action":[
"lambda:AddPermission"
],
"Resource":"*"
}
]
}
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment