This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cuid = require('cuid') | |
const AWS = require('aws-sdk') | |
// Add these to your lambda's environment variables | |
const REGION = 'us-east-1' | |
const SNS_ARN = process.env.SNS_ARN | |
const TEMPLATE_URL = process.env.TEMPLATE_URL | |
const TRUSTED_ACCOUNT = process.env.TRUSTED_ACCOUNT | |
var SNS = new AWS.SNS(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cuid = require('cuid') | |
const AWS = require('aws-sdk') | |
const REGION = 'us-east-1' | |
const SNS_ARN = process.env.SNS_ARN | |
const TEMPLATE_URL = process.env.TEMPLATE_URL | |
const TRUSTED_ACCOUNT = process.env.TRUSTED_ACCOUNT | |
var SNS = new AWS.SNS(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Parameters" : { | |
"TrustedAccount" : { | |
"Type" : "String", | |
"Description" : "Your account id, to be trusted by the user" | |
}, | |
"ExternalId" : { | |
"Type" : "String", | |
"Description" : "Your secret customer unique id" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const response = require('cfn-response-promise') | |
const util = require('util') | |
async function replyToResourceRequest(event, context) { | |
return await response.send(event, context, response.SUCCESS, {}); | |
} | |
async function saveUserDetailsToDb(AccountId, RoleArn, ExternalID) { | |
console.log(`Persisting the user info to the database ${AccountId}, ${RoleArn}, ${ExternalID}`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const util = require('util') | |
const AWS = require('aws-sdk') | |
const cloudWatchLogs = new AWS.CloudWatchLogs(); | |
let DESTINATION_ARN = process.env.DESTINATION_ARN | |
async function registerLogGroupToLogz(logGroupName) { | |
let filterName = 'sample-filterName-1' | |
let filterPattern = '' //everything |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"source": [ | |
"aws.logs" | |
], | |
"detail-type": [ | |
"AWS API Call via CloudTrail" | |
], | |
"detail": { | |
"eventSource": [ | |
"logs.amazonaws.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012–10–17", | |
"Statement": [ | |
{ | |
"Sid": "Manual", | |
"Effect": "Allow", | |
"Action": "logs:PutSubscriptionFilter", | |
"Resource": "arn:aws:logs:us-east-1:{YOUR_ACCOUNT_ID}:log-group:/aws/Lambda/*" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Func01LogGroup": { | |
"Type": "AWS::Logs::LogGroup", | |
"Properties": { | |
"LogGroupName": { | |
"Fn::Sub": [ | |
"/aws/Lambda/${LambdaName}", | |
{ | |
"LambdaName": { | |
"Ref": "Func01Name" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Transform": "AWS::Serverless-2016-10-31", | |
"Resources": { | |
"ApiGateway01": { | |
"Type": "AWS::Serverless::Api", | |
"Properties": { | |
"StageName": "Prod" | |
} | |
}, |