Skip to content

Commit 8525402

Browse files
authored
Merge pull request #99 from aws-samples/s3-bucket-ownership
added bucket owner condition to s3 bucket check
2 parents 795d752 + f37c3b0 commit 8525402

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ We have also created a workshop that you can use as a reference to understand th
1111
- This reference architecture uses Python. Make sure you have Python 3.9 or above installed.
1212
- Make sure you have [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) installed.
1313
- Make sure you have the latest version of [AWS CDK CLI](https://docs.aws.amazon.com/cdk/latest/guide/cli.html) installed. Not having the release version of CDK can cause deployment issues.
14-
- Make sure you have the latest version of [git-remote-codecommit](https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-git-remote-codecommit.html) installed.
1514
- Make sure that you have Node 18 or above.
15+
- Make sure that you have docker cli installed and docker daemon running.
1616

1717
## Deploying
1818

@@ -25,7 +25,7 @@ cd scripts
2525

2626
This script will deploy the following:
2727

28-
- Creates a codecommit repo in your AWS account and pushes this reference solutions code to the repo
28+
- Creates a Amazon S3 bucket in your AWS account and pushes this reference solutions code to the bucket
2929
- Clones SaaS Builder Toolkit(SBT) control plane repo and installs control plane which has all shared services and control plane UI.
3030
- Deploys cdk stack `serverless-saas-ref-arch-bootstrap-stack` which provisions
3131
- SaaS Builder Toolkit(SBT) core application plane component which provides infrastructure to provision/de-provision a tenant

scripts/install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ export CDK_PARAM_S3_BUCKET_NAME="serverless-saas-${ACCOUNT_ID}-${REGION}"
1515
echo "CDK_PARAM_S3_BUCKET_NAME: ${CDK_PARAM_S3_BUCKET_NAME}"
1616
export CDK_SOURCE_NAME="source.zip"
1717

18-
if aws s3api head-bucket --bucket $CDK_PARAM_S3_BUCKET_NAME 2>/dev/null; then
19-
echo "Bucket $CDK_PARAM_S3_BUCKET_NAME already exists."
18+
if aws s3api head-bucket --bucket $CDK_PARAM_S3_BUCKET_NAME --expected-bucket-owner ${ACCOUNT_ID} 2>/dev/null; then
19+
echo "Bucket $CDK_PARAM_S3_BUCKET_NAME already exists and owned by this account."
2020
else
21-
echo "Bucket $CDK_PARAM_S3_BUCKET_NAME does not exist. Creating a new bucket in $REGION region"
21+
echo "Bucket $CDK_PARAM_S3_BUCKET_NAME does not exist or is not owned by this account. Creating a new bucket in $REGION region"
2222

2323
if [ "$REGION" == "us-east-1" ]; then
2424
aws s3api create-bucket --bucket $CDK_PARAM_S3_BUCKET_NAME

0 commit comments

Comments
 (0)