diff --git a/README.md b/README.md index 4393501..dd840b6 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ Options: -s3bu --s3-bucket The S3 bucket where the code package will be uploaded -s3pr --s3-profile A separate AWS credential profile to upload code packages to the S3 Bucket -rv --release-version The release version to deploy, e.g. '0.5.2' or 'latest' + -cr --collector-regions Regions where the collector CloudFormation stack will be deployed (space separated) -lr --log-retention-days The number of days to retain the Lambda Function's logs (default: 90) -ld --log-level-debug Enable the debug logging for the Lambda Function @@ -121,6 +122,12 @@ Create the infrastructure with the latest release using either the `default`, `$ ./deploy_autotag.sh --region us-west-2 --s3-bucket my-autotag-bucket --release-version latest create ``` +Create the infrastructure that tags resources only in specific regions. + +```bash +./deploy_autotag.sh --region us-west-2 --s3-bucket my-autotag-bucket --release-version latest --collector-regions us-west-1 us-west-2 eu-west-1 create +``` + Create the infrastructure with the latest release using a named AWS credentials profile. ```bash diff --git a/deploy_autotag.sh b/deploy_autotag.sh index f7361fc..a5450ae 100755 --- a/deploy_autotag.sh +++ b/deploy_autotag.sh @@ -305,7 +305,7 @@ EOF # Deploy Collector CloudFormation Template - ACTIVE_REGIONS=$(aws ec2 describe-regions $AWS_CREDENTIALS --region "$MAIN_STACK_AWS_REGION" | jq -r '.Regions | sort_by(.RegionName) | .[].RegionName') + [[ -z $ACTIVE_REGIONS ]] && ACTIVE_REGIONS=$(aws ec2 describe-regions $AWS_CREDENTIALS --region "$MAIN_STACK_AWS_REGION" | jq -r '.Regions | sort_by(.RegionName) | .[].RegionName') for REGION in $ACTIVE_REGIONS ; do @@ -441,7 +441,7 @@ EOF wait-for-stack 'Main' "$MAIN_STACK_NAME" "$MAIN_STACK_AWS_REGION" - ACTIVE_REGIONS=$(aws ec2 describe-regions $AWS_CREDENTIALS --region "$MAIN_STACK_AWS_REGION" | jq -r '.Regions[].RegionName') + [[ -z $ACTIVE_REGIONS ]] && ACTIVE_REGIONS=$(aws ec2 describe-regions $AWS_CREDENTIALS --region "$MAIN_STACK_AWS_REGION" | jq -r '.Regions[].RegionName') for REGION in $ACTIVE_REGIONS ; do @@ -639,6 +639,7 @@ Options: -s3bu --s3-bucket The S3 bucket where the code package will be uploaded -s3pr --s3-profile A separate AWS credential profile to upload code packages to the S3 Bucket -rv --release-version The release version to deploy, e.g. '0.5.2' or 'latest' + -cr --collector-regions Regions where the collector CloudFormation stack will be deployed (space separated) -lr --log-retention-days The number of days to retain the Lambda Function's logs (default: 90) -ld --log-level-debug Enable the debug logging for the Lambda Function @@ -651,6 +652,7 @@ EOF } PARAMS='' +ACTIVE_REGIONS='' while (( "$#" )); do case "$1" in -h|--help) @@ -676,6 +678,14 @@ while (( "$#" )); do export RELEASE_VERSION=$2 shift 2 ;; + -cr|--collector-regions) + while [[ $2 != -* && $# -gt 1 ]]; do + ACTIVE_REGIONS="$ACTIVE_REGIONS $2" + shift + done + ACTIVE_REGIONS="${ACTIVE_REGIONS#"${ACTIVE_REGIONS%%[![:space:]]*}"}" + shift + ;; -lr|--log-retention-days) export LOG_RETENTION_DAYS=$2 shift 2