Skip to content

Can not create s3 bucket

0

We previously hosted static files on an S3 bucket named "mybucketblabla", which we retired a few months ago. We're now working on a new project that requires re-creating this bucket. However, when attempting to create it again, we receive the following error:

The specified bucket name is already taken. To make your bucket name unique, try adding your account ID to the specified bucket name.

Strangely, when we try to access the bucket (both with and without credentials), the API responds with a NoSuchBucket error.

Can someone clarify how this is possible? Is the bucket still reserved in some way, or is there a delay in full deletion/availability?

asked a year ago487 views

3 Answers
2

Amazon S3 bucket names are globally unique, meaning that once a bucket is created, its name cannot be reused by any AWS account, even after deletion. This explains why you are encountering the "Bucket name already taken" error, despite the API returning a "NoSuchBucket" response when attempting to access it.

EXPERT

answered a year ago

  • If a certain period of time has passed since you deleted an S3 bucket, it is possible to create one with the same name. https://repost.aws/knowledge-center/s3-conflicting-conditional-operation

    In many cases, you can create a bucket within a few hours after the previous bucket is deleted. However, it might take 48-72 hours for the changes to become consistent. It's a best practice to wait at least 48 hours to recreate the S3 bucket. For more information, see How do I troubleshoot errors when creating an Amazon S3 bucket?

1

The situation you're experiencing is a common issue with S3 bucket names, and there are a few reasons why this might be happening:

  1. Bucket name reservation: When an S3 bucket is deleted, its name isn't immediately available for reuse. AWS reserves the bucket name for a period of time, which can range from a few hours to several months. This is done to prevent potential abuse and to ensure consistency across their global system.

  2. Account deletion: If the bucket was associated with an AWS account that was subsequently closed, the bucket name might remain unavailable for an extended period. AWS has a 90-day "cooling off" period after an account is closed, during which resources like bucket names are preserved in case the account is reopened.

  3. Global namespace: Remember that S3 bucket names are unique across all of AWS, not just within your account. It's possible that another AWS user has created a bucket with the same name in the time since you deleted yours.

  4. Orphaned resources: In some cases, when an account is deleted without properly removing all resources, S3 buckets can become "orphaned." These buckets still occupy the namespace but are inaccessible.

The NoSuchBucket error you're receiving when trying to access the bucket confirms that the bucket doesn't currently exist, but the name is still reserved or in use somewhere in the AWS system.

To resolve this, you have a few options:

  1. Wait longer: The name may become available after AWS's reservation period expires.

  2. Use a different name: Consider modifying your bucket naming strategy, perhaps by adding a unique identifier or timestamp.

  3. Contact AWS Support: They might be able to provide more information or assistance, especially if this is related to an account closure or orphaned resource.

  4. Use a subdomain or different region: In some cases, you might be able to create a bucket with a similar name by using a subdomain prefix or trying in a different AWS region.

Remember, it's generally a good practice to use unique, hard-to-guess names for S3 buckets to avoid conflicts and potential security issues.
Sources
Cannot re-create S3 bucket present in a deleted account | AWS re:Post
Cannot find new s3 bucket | AWS re:Post

answered a year ago

EXPERT

reviewed a year ago

1

The S3 bucket names are unique at AWS level. That is, if I create a bucket with name bucket-123, then no other AWS account can create a bucket with the same name. Therefore, it's possible that you may not be able to create a bucket with the desired name. What I usually do is append the account id at the end - bucket-123-{Accountid} to make the bucket names unique. Again, nothing stopping another person creating a bucket with that name, but chances will be lower.

EXPERT

answered a year ago

EXPERT

reviewed a year 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.