FG
💻 Software☁️ Cloud & DevOpsAmazon

Output collision when deploying a split service into the same bucket

Fresh5 days ago
Mar 14, 20260 views
Confidence Score55%
55%

Problem

Due to #9313, the name of the bucket where the deployment occurred is being exported by default. If a service is divided into multiple files deploying to the same bucket, the default outputs are gonna conflict with each other. <details> <summary><code>serverless_A.yml</code></summary> [code block] </details> <details> <summary><code>serverless_B.yml</code></summary> [code block] </details> <b>Installed version</b> [code block]

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Resolve Output Collision in Split Service Deployments

Medium Risk

The issue arises because the default output for the bucket name is being exported in both serverless_A.yml and serverless_B.yml. When multiple services are deployed to the same bucket, they inadvertently create conflicting output names, leading to deployment errors.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Modify Output Names in serverless_A.yml

    Change the output name for the bucket in serverless_A.yml to avoid conflicts with serverless_B.yml. This can be done by specifying a unique name for the output.

    yaml
    Outputs:
      UniqueBucketNameA:
        Value: !Ref MyS3Bucket
        Export:
          Name: UniqueBucketNameA-${self:provider.stage}
  2. 2

    Modify Output Names in serverless_B.yml

    Similarly, update the output name for the bucket in serverless_B.yml to ensure it is unique and does not conflict with serverless_A.yml.

    yaml
    Outputs:
      UniqueBucketNameB:
        Value: !Ref MyS3Bucket
        Export:
          Name: UniqueBucketNameB-${self:provider.stage}
  3. 3

    Deploy Both Services

    Deploy both serverless_A.yml and serverless_B.yml to the same bucket after making the changes. This will ensure that the outputs do not conflict.

    bash
    serverless deploy -c serverless_A.yml
    serverless deploy -c serverless_B.yml
  4. 4

    Verify Outputs

    Check the CloudFormation stack outputs for both services to confirm that the outputs are correctly named and do not conflict with each other.

    bash
    aws cloudformation describe-stacks --stack-name <your-stack-name>

Validation

Confirm that the outputs for both serverless_A and serverless_B are listed correctly in the CloudFormation console without any naming conflicts. Ensure that both services function as expected without deployment errors.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

serverlesslambdaawsenhancementhelp-wanteddeprecation