aws allow-my-ip "Proxy-Cerebro" tcp 22 rbd_sys
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
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[*]' | |
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[*].Tags[?Key==`Name`]' | |
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?Tags[?starts_with(Value, `registration`)]]' | |
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?Tags[?starts_with(Value, `email`)]]' | |
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[] | [?contains(Tags[?Key==`Name`].Value, `email-01`)]' --output table |
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'); | |
aws.config.loadFromPath('./config.json'); | |
const ses = new aws.SES(); | |
/** | |
* author: athakur | |
* aws ses create-template --cli-input-json fileb://test_template.json --region us-east-1 --profile osfg | |
* aws ses update-template --cli-input-json fileb://test_template.json --region us-east-1 --profile osfg | |
* @param {*} callback | |
*/ |
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
aws ec2 describe-instances | |
# | |
aws ec2 start-instances --instance-ids i-1348636c | |
# | |
aws sns publish --topic-arn arn:aws:sns:us-east-1:546419318123:OperationsError --message "Script Failure" | |
# | |
aws sqs receive-message --queue-url https://queue.amazonaws.com/546419318123/Test | |
# | |
aws autoscaling create-auto-scaling-group help | |
# |
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
#!/bin/bash | |
set -eu | |
# The function creates global variables with the parsed results. | |
# It returns 0 if parsing was successful or non-zero otherwise. | |
# | |
# [schema://][user[:password]@]host[:port][/path][?[arg1=val1]...][#fragment] | |
# | |
# from http://vpalos.com/537/uri-parsing-using-bash-built-in-features/ | |
parse_url() { |
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
#!/bin/bash | |
DOMAIN=$1 | |
mkdir -p /tmp/appwatch-bbl | |
mkdir -p /tmp/certbot | |
gsutil cp gs://appwatch-bbl/my-app-config.json /tmp/appwatch-bbl/my-app-config.json | |
chmod 600 /tmp/appwatch-bbl/my-app-config.json |
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
#!/bin/bash -xe | |
domain_name=$1 | |
[[ $# < 1 ]] && echo "$0 <domain_name>" && exit 1 | |
name=$(echo $domain_name | tr -d '.') | |
policy_name=$(basename $0 .sh)$(echo ${name:0:1} | tr 'a-z' 'A-Z')${name:1} | |
hostedzone=$(aws route53 list-hosted-zones | | |
jq -r '.HostedZones[] | select(.Name == "'$domain_name'.") | .Id') | |
delete_policy=$(dirname $0)/delete_and_detach_policy.sh | |
[[ -f $delete_policy ]] && $delete_policy $policy_name | |
[[ -z $hostedzone ]] && echo "unknown domain name: ${domain_name}" && exit 1 |
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
# find the owner of an AWS access key | |
# https://stackoverflow.com/a/31275655 | |
for user in $(aws iam list-users --output text | awk '{print $NF}'); do | |
aws iam list-access-keys --user $user --output text | |
done | |
# alternative that uses jq(1) insteaed of awk(1) | |
for user in $(aws iam list-users --query 'Users[*].UserName' --output text); do |
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
#!/bin/bash | |
set -e | |
# Set environment variables | |
export AWS_IAM_ROLE=$(curl "http://169.254.169.254/latest/meta-data/iam/security-credentials/" 2>/dev/null) | |
if [ "${AWS_IAM_ROLE}" ]; then | |
export AWS_ACCESS_KEY_ID=$(curl "http://169.254.169.254/latest/meta-data/iam/security-credentials/${AWS_IAM_ROLE}" 2>/dev/null | jq -r .AccessKeyId) | |
export AWS_SECRET_ACCESS_KEY=$(curl "http://169.254.169.254/latest/meta-data/iam/security-credentials/${AWS_IAM_ROLE}" 2>/dev/null | jq -r .SecretAccessKey) |
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
#!/bin/bash | |
AWS_DEFAULT_REGION=$1 | |
AWS_ACCESS_KEY_ID=$2 | |
AWS_SECRET_ACCESS_KEY=$3 | |
domain=$4 | |
networkStack=$5 | |
#Parameters validation | |
if [[ $1 && $2 && $3 ]]; then | |
export AWS_DEFAULT_REGION AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY |