Amplify build failed because the bucket already exists

0

Hi,

I am trying to deploy an amplify app as per https://webapp.serverlessworkshops.io/staticwebhosting/deploy/ but the build is failing because of an existing bucket

I am unable to see the bucket in S3. How can I delete the bucket? or how to resolve this issue?

2022-02-25T03:31:32.457Z [INFO]: An error occurred when creating the CloudFormation stack
2022-02-25T03:31:32.459Z [WARNING]: ✖ Root stack creation failed
2022-02-25T03:31:32.464Z [INFO]: AlreadyExistsException: Stack [amplify-wildrydes-prod-32220] already exists
                                 at Request.extractError (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/protocol/query.js:50:29)
                                 at Request.callListeners (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
                                 at Request.emit (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
                                 at Request.emit (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:686:14)
                                 at Request.transition (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)
                                 at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)
                                 at /root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10
                                 at Request.<anonymous> (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)
                                 at Request.<anonymous> (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:12)
                                 at Request.callListeners (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
                                 at Request.emit (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
                                 at Request.emit (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:686:14)
                                 at Request.transition (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)
                                 at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)
                                 at /root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10
                                 at Request.<anonymous> (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)
                                 at Request.<anonymous> (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:12)
                                 at Request.callListeners (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
                                 at callNextListener (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
                                 at IncomingMessage.onEnd (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/event_listeners.js:335:13)
                                 at IncomingMessage.emit (events.js:412:35)
                                 at IncomingMessage.emit (domain.js:475:12)
                                 at endReadableNT (internal/streams/readable.js:1334:12)
                                 at processTicksAndRejections (internal/process/task_queues.js:82:21) {
                                 code: 'AlreadyExistsException',
                                 time: 2022-02-25T03:31:32.456Z,
                                 requestId: '92bb3d71-1610-43c4-a385-54cb25e459cd',
                                 statusCode: 400,
                                 retryable: false,
                                 retryDelay: 81.16703459454344
                                 }
2022-02-25T03:31:32.487Z [ERROR]: !!! Build failed
2022-02-25T03:31:32.487Z [ERROR]: !!! Non-Zero Exit Code detected
2022-02-25T03:31:32.488Z [INFO]: # Starting environment caching...
2022-02-25T03:31:32.488Z [INFO]: # Environment caching completed
Terminating logging...

Thank you

2 Answers
0
Accepted Answer

Hello Letty,

I think this was an issue. I raised a github defect https://github.com/aws-amplify/amplify-cli/issues/10579 which was resolved recently

A few other people also seem to have had the same issue. I understand that the buckets names are unique, however we don't have the control on bucket name when we use amplify

Cheers Sri

profile picture
Sri
answered 2 years ago
profile picture
EXPERT
reviewed 19 days ago
0

Hi there!

From the notes, I understand that you trying to deploy an amplify app and you are getting the error “Bucket Already Exists”, which causes your deployment to fail. Please correct me if I misunderstood.

This error message indicates that another AWS account owns a bucket with the same name, which means you must use a different bucket name to create the bucket. Amazon S3 bucket names must be unique globally, please refer to [1] on bucket restrictions and limitations and bucket naming rules.

I hope you find the above information helpful.

Have a great day ahead!

References:

[1] https://docs.aws.amazon.com/AmazonS3/latest/userguide/BucketRestrictions.html#bucketnamingrules

Letty
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions