Last active
March 20, 2016 10:48
-
-
Save yu81/371ee999e48d830de057 to your computer and use it in GitHub Desktop.
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 -xv | |
profile=$1 # determine aws account to deploy. | |
eb_user_key=$2 # set environment variable to configuration of eb. | |
[ "${profile}" = "" ] && profile=default | |
[ "${eb_user_key}" = "" ] && eb_role_key=default-eb | |
if [ "${eb_user_key}" != "" ];then | |
AWS_EB_KEY_INFO=$(php -r '$credentials = parse_ini_file("'${HOME}'/.aws/credentials", true);echo $credentials["'${eb_user_key}'"]["aws_access_key_id"] . " " . $credentials["'${eb_user_key}'"]["aws_secret_access_key"];') | |
set -- ${AWS_EB_KEY_INFO} | |
AWS_ACCESS_KEY_ID=$1 | |
AWS_SECRET_KEY=$2 | |
eb create --vpc \ | |
--vpc.id vpc-xxxxxxxx \ | |
--vpc.ec2subnets subnet-yyyyyyyy,subnet-zzzzzzzz \ | |
--vpc.elbsubnets subnet-yyyyyyyy,subnet-zzzzzzzz \ | |
--vpc.elbpublic \ | |
--vpc.publicip \ | |
--vpc.securitygroups sg-vvvvvvvv \ | |
--envvars AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID},AWS_SECRET_KEY=${AWS_SECRET_KEY},AWS_SECRET_ACCESS_KEY=${AWS_SECRET_KEY} \ | |
--timeout 3600 \ | |
--profile ${profile} | |
else | |
eb create --vpc \ | |
--vpc.id vpc-xxxxxxxx \ | |
--vpc.ec2subnets subnet-yyyyyyyy,subnet-zzzzzzzz \ | |
--vpc.elbsubnets subnet-yyyyyyyy,subnet-zzzzzzzz \ | |
--vpc.elbpublic \ | |
--vpc.publicip \ | |
--vpc.securitygroups sg-vvvvvvvv \ | |
--timeout 600 \ | |
--profile ${profile} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment