ERROR REFERENCE
BucketAlreadyExists / BucketAlreadyOwnedByYou
The template declares an AWS::S3::Bucket with an
explicit BucketName, and that name is already taken.
Bucket names are globally unique across every AWS account, so the
collision can be with a stranger's bucket — or with one your own
account left behind.
WHAT IT MEANS
What this error means
BucketAlreadyExists— another AWS account owns the name. No permission or retry fixes this; the name is simply taken.BucketAlreadyOwnedByYou— your own account owns it, usually a leftover from a half-deleted stack or a manual creation.The requested bucket name is not available...— the newer resource-handler phrasing of the same collision.
FIX
How to fix it
-
Prefer omitting
BucketNameentirely. CloudFormation then generates a unique name, and the collision class disappears. Reference the bucket by!Refwhere its name is needed. -
For
BucketAlreadyOwnedByYou: check whether a previous stack left the bucket behind before reusing the name — importing the existing bucket or deleting it deliberately are both better than fighting the collision. Look before deleting; leftover buckets often still hold artifacts. -
If the name must be fixed and branded, add a
uniquifying component (account id or region as a suffix via
!Sub), so each account and region gets its own name.
AUTOMATE THE TRIAGE
Diagnose this automatically
SAM Doctor recognizes both error codes and the resource-handler wording (high confidence), and keeps them distinct from invalid-name validation failures. Runs locally; no AWS access, no log upload.
python -m pip install sam-doctor
sam-doctor diagnose deployment.log --format markdown
RELATED
Related errors
- DELETE_FAILED — how those leftover buckets get orphaned in the first place.
- S3 error: Access Denied (deployment bucket) — the artifact-bucket cousin of this failure.