@@ -8,14 +8,16 @@ if [[ -z "$CDK_PARAM_SYSTEM_ADMIN_EMAIL" ]]; then
88fi
99
1010REGION=$( aws ec2 describe-availability-zones --output text --query ' AvailabilityZones[0].[RegionName]' ) # Region setting
11- export CDK_PARAM_S3_BUCKET_NAME=" saas-reference-architecture-ecs-$REGION "
11+ ACCOUNT_ID=$( aws sts get-caller-identity --query Account --output text)
12+
13+ export CDK_PARAM_S3_BUCKET_NAME=" saas-reference-architecture-ecs-$ACCOUNT_ID -$REGION "
1214
1315# Create S3 Bucket for provision source.
1416
1517if aws s3api head-bucket --bucket $CDK_PARAM_S3_BUCKET_NAME 2> /dev/null; then
1618 echo " Bucket $CDK_PARAM_S3_BUCKET_NAME already exists."
1719else
18- echo " Bucket $CDK_PARAM_S3_BUCKET_NAME does not exist. Creating a new bucket in $REGION region"
20+ echo " Bucket $CDK_PARAM_S3_BUCKET_NAME does not exist. Creating a new bucket in $REGION region in $ACCOUNT_ID "
1921
2022 if [ " $REGION " == " us-east-1" ]; then
2123 aws s3api create-bucket --bucket $CDK_PARAM_S3_BUCKET_NAME
4648echo " Bucket exists: $CDK_PARAM_S3_BUCKET_NAME "
4749
4850cd ../
49- zip -r source.zip . -x " .git/*" -x " **/node_modules/*" -x " **/cdk.out/*" -x " **/.aws-sam/*"
51+ zip -rq source.zip . -x " .git/*" -x " **/node_modules/*" -x " **/cdk.out/*" -x " **/.aws-sam/*"
5052export CDK_PARAM_COMMIT_ID=$( aws s3api put-object --bucket " ${CDK_PARAM_S3_BUCKET_NAME} " --key " source.zip" --body " ./source.zip" --output text)
5153
5254rm source.zip
@@ -74,19 +76,19 @@ SERVICES=$(aws ecs list-services --cluster $CDK_BASIC_CLUSTER --query 'serviceAr
7476for SERVICE in $SERVICES ; do
7577 SERVICE_NAME=$( echo $SERVICE | rev | cut -d ' /' -f 1 | rev)
7678
79+ echo -n " ==== Service Connect Disable: "
7780 aws ecs update-service \
7881 --cluster $CDK_BASIC_CLUSTER \
7982 --service $SERVICE_NAME \
8083 --service-connect-configuration ' enabled=false' \
81- --no-cli-pager
84+ --no-cli-pager --query ' service.serviceArn ' --output text
8285
83- echo " Service Connect disabled for service: $SERVICE_NAME "
8486done
8587
8688npm install
8789
8890npx cdk bootstrap
89- npx cdk deploy --all --require-approval never
91+ npx cdk deploy --all --require-approval= never
9092
9193# Get SaaS application url
9294ADMIN_SITE_URL=$( aws cloudformation describe-stacks --stack-name controlplane-stack --query " Stacks[0].Outputs[?OutputKey=='adminSiteUrl'].OutputValue" --output text)
0 commit comments