Skip to content

Instantly share code, notes, and snippets.

@daisuke-morita
Created February 7, 2016 03:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daisuke-morita/97dc9951df11ab364eae to your computer and use it in GitHub Desktop.
Save daisuke-morita/97dc9951df11ab364eae to your computer and use it in GitHub Desktop.
deploy-to-staging.sh - リリースパッケージをアプリケーションサーバーにホットデプロイする
#!/bin/bash
set -ex
export AWS_DEFAULT_REGION="ap-northeast-1"
SGID="sg-xxxxxxxx"
MYIP="`dig +short myip.opendns.com @resolver1.opendns.com`"
cd $(dirname $(readlink -f $0))
trap "aws ec2 revoke-security-group-ingress --group-id ${SGID} --protocol tcp --port 22 --cidr ${MYIP}/32" 0 1 2 3 15
aws ec2 authorize-security-group-ingress --group-id ${SGID} --protocol tcp --port 22 --cidr ${MYIP}/32
cd ../deploy && ./deploy-to-staging.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment