Skip to content

[Bugfix] Fix issues in deploy.sh when a profile is passed in #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions automated-deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@ This guide explains how to deploy the AWS Glue data catalog utility in both the
},
"Action": [
"s3:GetBucketLocation",
"s3:ListBucket"
"s3:ListBucket",
"s3:GetObject"
],
"Resource": "arn:aws:s3:::import-large-table-b2465b90-638f-11ea-8000-0a52752701a6"
"Resource": [
"arn:aws:s3:::import-large-table-b2465b90-638f-11ea-8000-0a52752701a6",
"arn:aws:s3:::import-large-table-b2465b90-638f-11ea-8000-0a52752701a6/*"
]
}
]
}
Expand Down
6 changes: 3 additions & 3 deletions automated-deployment/source-account/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ if ! $pflag
then
echo "-p not specified, using default..." >&2
PROFILE="default"
SOURCE_REGION=$(aws configure get region --profile ${PROFILE})
SOURCE_ACCOUNT=$(aws sts get-caller-identity --profile ${PROFILE} | python3 -c "import sys, json; print(json.load(sys.stdin)['Account'])")
fi
SOURCE_REGION=$(aws configure get region --profile ${PROFILE})
SOURCE_ACCOUNT=$(aws sts get-caller-identity --profile ${PROFILE} | python3 -c "import sys, json; print(json.load(sys.stdin)['Account'])")
if ! $sflag
then
S3_BUCKET=glue-data-catalog-replication-$SOURCE_REGION-$SOURCE_ACCOUNT
Expand Down Expand Up @@ -110,6 +110,6 @@ else
fi

echo "Subscribing Target account to SNS Schema Distribution topic..."
aws sns add-permission --label lambda-access --aws-account-id $TARGET_ACCOUNT \
aws sns add-permission --profile $PROFILE --label lambda-access --aws-account-id $TARGET_ACCOUNT \
--topic-arn arn:aws:sns:$SOURCE_REGION:$SOURCE_ACCOUNT:SchemaDistributionSNSTopic \
--action-name Subscribe ListSubscriptionsByTopic Receive
8 changes: 4 additions & 4 deletions automated-deployment/target-account/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ if ! $pflag
then
echo "-p not specified, using default..." >&2
PROFILE="default"
TARGET_REGION=$(aws configure get region --profile ${PROFILE})
TARGET_ACCOUNT=$(aws sts get-caller-identity --profile ${PROFILE} | python3 -c "import sys, json; print(json.load(sys.stdin)['Account'])")
fi
TARGET_REGION=$(aws configure get region --profile ${PROFILE})
TARGET_ACCOUNT=$(aws sts get-caller-identity --profile ${PROFILE} | python3 -c "import sys, json; print(json.load(sys.stdin)['Account'])")
if ! $sflag
then
S3_BUCKET=glue-data-catalog-replication-$TARGET_REGION-$TARGET_ACCOUNT
Expand Down Expand Up @@ -117,11 +117,11 @@ else
fi

echo "Subscribing Lambda to Source SNS Schema Distribution topic..."
aws lambda add-permission --function-name ImportLambda \
aws lambda add-permission --profile $PROFILE --function-name ImportLambda \
--source-arn arn:aws:sns:$SOURCE_REGION:$SOURCE_ACCOUNT:SchemaDistributionSNSTopic \
--statement-id sns-x-account --action "lambda:InvokeFunction" \
--principal sns.amazonaws.com

aws sns subscribe --region $SOURCE_REGION --protocol lambda \
aws sns subscribe --profile $PROFILE --region $SOURCE_REGION --protocol lambda \
--topic-arn arn:aws:sns:$SOURCE_REGION:$SOURCE_ACCOUNT:SchemaDistributionSNSTopic \
--notification-endpoint arn:aws:lambda:$TARGET_REGION:$TARGET_ACCOUNT:function:ImportLambda