From 30447f376b93c33132f285846ca78957b9755b18 Mon Sep 17 00:00:00 2001 From: starman69 Date: Sun, 31 May 2026 17:30:49 -0700 Subject: [PATCH] deploy api stack via template-url --- .github/workflows/ci-infra-deploy.yml | 10 +++++++--- .github/workflows/prod-infra-deploy.yml | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-infra-deploy.yml b/.github/workflows/ci-infra-deploy.yml index a37c2de..34a3560 100644 --- a/.github/workflows/ci-infra-deploy.yml +++ b/.github/workflows/ci-infra-deploy.yml @@ -176,9 +176,13 @@ jobs: if: inputs.stack == 'api' || inputs.stack == 'all' run: | STACK_NAME="${{ env.PREFIX }}-api-stack" - TEMPLATE="totem-api/infrastructure/cloudformation/api.yml" PARAMS_FILE="totem-api/infrastructure/params-api-staging.json" + # api.yml exceeds the 51,200-byte --template-body limit, so deploy from + # the S3 copy uploaded above via --template-url (1 MB limit). Bucket must + # be in the same region as the stack (us-west-2). + TEMPLATE_URL="https://${{ env.S3_BUCKET }}.s3.${{ env.AWS_REGION }}.amazonaws.com/totem-api/cloudformation/api-${{ inputs.release_version }}.yml" + # Start with Environment + AppVersion (not in param file) PARAMS="ParameterKey=Environment,ParameterValue=${{ env.ENVIRONMENT }}" PARAMS="$PARAMS ParameterKey=AppVersion,ParameterValue=${{ inputs.release_version }}" @@ -193,7 +197,7 @@ jobs: echo "Updating existing stack: $STACK_NAME" UPDATE_OUTPUT=$(aws cloudformation update-stack \ --stack-name "$STACK_NAME" \ - --template-body "file://$TEMPLATE" \ + --template-url "$TEMPLATE_URL" \ --parameters $PARAMS \ --capabilities CAPABILITY_NAMED_IAM 2>&1) && { echo "$UPDATE_OUTPUT" @@ -210,7 +214,7 @@ jobs: echo "Creating new stack: $STACK_NAME" aws cloudformation create-stack \ --stack-name "$STACK_NAME" \ - --template-body "file://$TEMPLATE" \ + --template-url "$TEMPLATE_URL" \ --parameters $PARAMS \ --capabilities CAPABILITY_NAMED_IAM aws cloudformation wait stack-create-complete --stack-name "$STACK_NAME" diff --git a/.github/workflows/prod-infra-deploy.yml b/.github/workflows/prod-infra-deploy.yml index 663d03b..3f5eddc 100644 --- a/.github/workflows/prod-infra-deploy.yml +++ b/.github/workflows/prod-infra-deploy.yml @@ -165,7 +165,11 @@ jobs: if: inputs.stack == 'api' || inputs.stack == 'all' run: | STACK_NAME="${{ env.PREFIX }}-api-stack" - TEMPLATE="totem-api/infrastructure/cloudformation/api.yml" + + # api.yml exceeds the 51,200-byte --template-body limit, so deploy from + # the S3 copy uploaded above via --template-url (1 MB limit). Bucket must + # be in the same region as the stack (us-east-1). + TEMPLATE_URL="https://${{ env.S3_BUCKET }}.s3.${{ env.AWS_REGION }}.amazonaws.com/totem-api/cloudformation/api-${{ inputs.release_version }}.yml" # Prod: Environment + AppVersion, Stripe params will need prod param file later PARAMS="ParameterKey=Environment,ParameterValue=${{ env.ENVIRONMENT }}" @@ -186,7 +190,7 @@ jobs: echo "Updating existing stack: $STACK_NAME" UPDATE_OUTPUT=$(aws cloudformation update-stack \ --stack-name "$STACK_NAME" \ - --template-body "file://$TEMPLATE" \ + --template-url "$TEMPLATE_URL" \ --parameters $PARAMS \ --capabilities CAPABILITY_NAMED_IAM 2>&1) && { echo "$UPDATE_OUTPUT" @@ -203,7 +207,7 @@ jobs: echo "Creating new stack: $STACK_NAME" aws cloudformation create-stack \ --stack-name "$STACK_NAME" \ - --template-body "file://$TEMPLATE" \ + --template-url "$TEMPLATE_URL" \ --parameters $PARAMS \ --capabilities CAPABILITY_NAMED_IAM aws cloudformation wait stack-create-complete --stack-name "$STACK_NAME"