Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid Bucket name when creating s3 bucket with AWS SDK

I tried to create a S3 bucket(thisIsTestBucket190) via AWS SDK (Node) and came across Invalid bucket name exception.

{ InvalidBucketName: The specified bucket is not valid.
    at Request.extractError (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/services/s3.js:577:35)
    at Request.callListeners (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at Request.emit (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/request.js:685:12)
    at Request.callListeners (/Users/niro273/Desktop/data-lake/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
  message: 'The specified bucket is not valid.',
  code: 'InvalidBucketName',
  region: null,
  time: 2018-03-29T04:51:02.692Z,
  requestId: '5D487CF96846EFE2',
  extendedRequestId: '1TzPeOv4c7zq+H+GV5kFMFO3Y6awoS79VCuf4C7lUmy/IucNEfbINEfEIiNp/Esz7t38ckYZbrU=',
  cfId: undefined,
  statusCode: 400,
  retryable: false,
  retryDelay: 34.88207359966853 }

Would be great if I could know what is the root cause.

like image 224
Nirojan Selvanathan Avatar asked Mar 29 '18 05:03

Nirojan Selvanathan


2 Answers

AWS provides naming standards when naming an aws bucket.

  • The bucket name can be between 3 and 63 characters long, and can contain only lower-case characters, numbers, periods, and dashes.

  • Each label in the bucket name must start with a lowercase letter or number.

  • The bucket name cannot contain underscores, end with a dash, have consecutive periods, or use dashes adjacent to periods.

  • The bucket name cannot be formatted as an IP address (198.51.100.24).

The name provided contains upper case letters, by switching to lower case letters the issue can be resolved.

https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html

like image 112
Nirojan Selvanathan Avatar answered Oct 27 '22 00:10

Nirojan Selvanathan


It's all about name convention!

The bucket name can be between 3 and 63 characters long, and can contain only lower-case characters, numbers, periods, and dashes.

like image 32
Josphat Mwania Avatar answered Oct 26 '22 23:10

Josphat Mwania