View gist:d2f71ddfe938c9fa8a95a918d8f5ba4e
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
Resources: | |
roleResourceName: | |
Type: AWS::IAM::Role | |
Properties: | |
RoleName: role-name | |
AssumeRolePolicyDocument: | |
Version: '2012-10-17' | |
Statement: | |
- Effect: Allow | |
Principal: |
View gist:cffa89efd51b074f8b9162c0a7c8ff4c
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
If you call lambda.invokeAsync() from one lambda calling another, if the calling lambda completes/exits before the second | |
lambda has been successfully invoked then depending on the timing it's possible the second Lambda will not invoke sucessfully. | |
The SDK docs show calling invokeAsync with a callback: | |
const params = { | |
"FunctionName": "fucntion-name-to-invoke", | |
"InvokeArgs": JSON.stringify(payload-to-pass-to-lambda) | |
}; | |
lambda.invokeAsync(params, function (error, result) { |
View gist:9c84601f7e42a7d9666d35b76ac3e1f0
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
fields @timestamp, @message | |
| filter @message like /string pattern to match/ | |
| sort @timestamp asc | |
fields @timestamp | |
| filter @message like /string pattern to match/ | |
#parse line, match a pattern, capture pattern match in this case * as named value userId | |
| parse "\"userId\": \"*\"" as userId | |
#only include where this has a value |
View gist:f2b59f5e3240f99852c806d3451728f7
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
#list-functions is paginated by default so need to set page-size, no-paginate or simiilar to get complete list | |
# see https://docs.aws.amazon.com/cli/latest/reference/lambda/list-functions.html | |
# https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html | |
aws lambda list-functions --region us-west-2 | |
--query 'Functions[?starts_with(FunctionName, `name-pattern-here`) == `true`].FunctionName' | |
--page-size 300 >> output.txt |
View gist:fe4bbcdfdb3080c56bd79637bb37f09f
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
Calling an api that doesn't exist in your API Gateway will return a 403 with the rather misleading response: | |
{ | |
"message": "Missing Authentication Token" | |
} |
View gist:e4c80cdada0ca1cc866ce5948fe8de78
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
#zsh git prompt customizations | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p' | |
} | |
COLOR_DEF=$'\e[0m' | |
COLOR_USR=$'\e[38;5;243m' | |
COLOR_DIR=$'\e[38;5;197m' | |
COLOR_GIT=$'\e[38;5;39m' | |
NEWLINE=$'\n' | |
setopt PROMPT_SUBST |
View gist:cb9244221334e30a0760f59c6b1dc099
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", | |
"Description": "Example ECS Service", | |
"Parameters": { | |
"VPCSecurityGroupId": { | |
"Type": "String" | |
}, | |
"VPCSubnetId": { | |
"Type": "String" | |
} |
View gist:51c028c7e7f464bb678f77b62bb93768
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
{ | |
"Description": "Example ECS TaskDef", | |
"Parameters": { | |
"Param1": { | |
"Description": "Example param 1", | |
"Type": "String" | |
} | |
}, | |
"Resources": { | |
"ECSTaskExampleExecutionRole": { |
View gist:30ddf444e5fdbd24e283ab71e690f241
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
{ | |
"Description" : "Example ECS Cluster", | |
"Resources" : { | |
"ECSClusterExample1" : { | |
"Type" : "AWS::ECS::Cluster", | |
"Properties" : { | |
"ClusterName" : "ecs-cluster-example1" | |
} | |
} | |
} |
View gist:28986702107be921974134e707b23baf
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
let arrayOfStrings = [ "bbb", "ccc", "aaa"]; | |
arrayOfStrings.sort(); //sorts as strings in alphabetical ascending order by default | |
//arrayOfStrings = ["aaa", "bbb", "ccc"] | |
let arrayOfInts = [3, 4, 1]; | |
//function passed to sort() returns > 0 if b comes after a, or if < 0 then a comes before b | |
arrayOfInts.sort( (a,b) => a - b ); | |
//arrayOfInts = [1, 3, 4]; |
NewerOlder