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
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
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
{ | |
"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 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
@Configuration | |
public class AppConfig { | |
private static final String dateFormat = "yyyy-MM-dd"; | |
private static final String dateTimeFormat = "yyyy-MM-dd HH:mm:ss"; | |
@Bean | |
public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() { | |
return builder -> { | |
builder.serializers(new LocalDateTimeSerializer( |
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 aws = require('aws-sdk'); | |
const s3 = new aws.S3({apiVersion: '2006-03-01'}); | |
const LambdaLog = require('lambda-log').LambdaLog; | |
const log = new LambdaLog({meta: {environment: process.env.ENVIRONMENT}}); | |
async function deleteObject(bucket, currentPath) { | |
var params = { |
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
alias ssh-tunnel='function _ssh_tunnel(){ set -x; port=$(gshuf -i 39152-65530 -n 1); ssh -f -N -L$port:$1:22 ec2-user@<DMZ_IP> -i ~/.ssh/dmz.pem ; ssh -i ~/.ssh/prod.pem ec2-user@127.0.0.1 -p $port ;};_ssh_tunnel' | |
# to run: | |
ssh-tunnel <SOME PROD IP> |
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
var fs = require('fs'); | |
var filePath = process.argv[2]; | |
var content = null; | |
fs.readFile(filePath, 'utf8', function (err, data) { | |
if (err) { | |
console.log('Error: ' + err); | |
return; | |
} |
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
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" | |
PROMPT='$fg[white]%* %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)${ret_status}%{$fg_bold[blue]%} % %{$reset_color%}' | |
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" |