AWS SAM "S3 Bucket does not exist" - Fix Deploy Bucket in CI
SAM packages your build artifacts to an S3 bucket before deploying, and the bucket it was told to use does not exist (or is in another region). Without it, the upload step fails.
What this error means
sam deploy fails while uploading the packaged artifact, saying the S3 bucket does not exist. It happens when the configured s3_bucket is wrong, the managed bucket was never created, or the region does not match.
Error: Failed to create/update stack: S3 Bucket does not exist.
Execute the command to create a new bucket:
aws s3 mb s3://<bucket-name>Common causes
No deployment bucket provisioned
The configured s3_bucket (in samconfig.toml or --s3-bucket) points at a bucket that was never created, or sam deploy --guided (which sets up a managed bucket) was never run in this account.
Bucket exists but in another region
S3 bucket names are global but buckets are regional. If the deploy region differs from the bucket’s region, SAM cannot use it and reports it missing.
How to fix it
Let SAM manage the bucket
Use --resolve-s3 so SAM creates and reuses a managed deployment bucket automatically.
sam deploy --resolve-s3 --no-confirm-changeset --region us-east-1Provision and pin an explicit bucket
Create a bucket in the deploy region and reference it consistently.
aws s3 mb s3://my-sam-artifacts-us-east-1 --region us-east-1
sam deploy --s3-bucket my-sam-artifacts-us-east-1 --region us-east-1How to prevent it
- Use
--resolve-s3(or a pinned bucket) so CI never depends on a manual--guidedrun. - Keep the deploy region and bucket region aligned.
- Commit
samconfig.tomlwith the bucket and region so every run is consistent.