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 | |
# gets iam security credentials from instance metadata and writes them to | |
# awscli environment variables and .s3cfg (for s3cmd) | |
# Usage: ec2-get-security-credentials ROLENAME DEFAULT_REGION | |
# ROLE=$1 | |
# DEFAULT_REGION=$2 | |
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 | |
# Summary: | |
# Bash script repoints all inbound access for a given AWS EC2 security group | |
# to your current IP addr(v4) as provided by ifconfig.me/ip | |
# To use this script: | |
# Pass the name of a security group as a command line argument | |
# e.g. $ aws_repoint_to_my_ip.sh SECURITYGROUPNAME |
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 | |
# chkconfig: 2345 99 10 | |
# description: Set Public IP from ElasticIP pool during instance startup | |
# processname: ipassign | |
# Provides: ipassign | |
# Required-Start: | |
# Required-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: | |
# Short-Description: Set Public IP from ElasticIP pool during instance startup |
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 AWS = require('aws-sdk'); | |
AWS.config.update({ | |
logger: process.stdout, | |
region: 'ap-northeast-1' | |
}); | |
var r53 = new AWS.Route53(); | |
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
#!/bin/bash | |
############################################################################### | |
# Helpers # | |
############################################################################### | |
# `is_set` accepts a function and checks if a variable is set. | |
# The function it accepts should generate a string for an error | |
# message | |
is_set() { |
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 | |
# | |
# region information: http://docs.aws.amazon.com/general/latest/gr/rande.html | |
# aws-cli ec2 describe-images: http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html | |
# | |
set -eu | |
aws_cmd=$(which aws ||:) | |
if [ -z "${aws_cmd}" ]; then | |
echo Please Install aws-cli >&2 |
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/sh | |
DEBUG="" | |
DATE=$(date +%Y-%m-%d) | |
HOSTNAME=`/bin/hostname` | |
AMINAME="$DATE-$HOSTNAME-AMI" | |
AMIDESC="$HOSTNAME backup to AMI on $DATE" | |
EC2_INSTANCE_ID="`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id || die \"wget instance-id has failed: $?\"`" | |
test -n "$EC2_INSTANCE_ID" || die 'cannot obtain instance-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
/* | |
this standalone nodejs code requires the following env variables to be set: | |
process.env.AWS_ACCESS_KEY_ID | |
process.env.AWS_S3_BUCKET | |
process.env.AWS_SECRET_ACCESS_KEY | |
*/ | |
/*jslint | |
bitwise: true, browser: true, | |
indent: 2, | |
maxerr: 8, |
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/sh | |
# To the extent possible under law, Viktor Szakats | |
# has waived all copyright and related or neighboring rights to this | |
# script. | |
# CC0 - https://creativecommons.org/publicdomain/zero/1.0/ | |
# SPDX-License-Identifier: CC0-1.0 | |
# THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
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
Install AWS CLI if missing. | |
http://docs.aws.amazon.com/cli/latest/userguide/installing.html | |
Configure AWS CLI | |
http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html | |
>> Roadblock: Missing keys: Ask [designated AWS admin] to give you keys. | |
>> Error: Region: Confirm your server's region. | |
Install EC2 API Tools if missing | |
https://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/set-up-ec2-cli-linux.html | |
>> Roadblock: Permission denied: Ask [designated AWS admin] to fix it. |