Skip to content

Instantly share code, notes, and snippets.

@danielmahal
Created September 13, 2016 09:14
Show Gist options
  • Save danielmahal/87522603e1d86fd66948b8c4a25fc010 to your computer and use it in GitHub Desktop.
Save danielmahal/87522603e1d86fd66948b8c4a25fc010 to your computer and use it in GitHub Desktop.
// Table copied from
// http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html
export default (region, bucket) => ({
'us-east-1': `${bucket}.s3-website-us-east-1.amazonaws.com`,
'us-west-1': `${bucket}.s3-website-us-west-1.amazonaws.com`,
'us-west-2': `${bucket}.s3-website-us-west-2.amazonaws.com`,
'ap-south-1': `${bucket}.s3-website.ap-south-1.amazonaws.com`,
'ap-northeast-2': `${bucket}.s3-website.ap-northeast-2.amazonaws.com`,
'ap-southeast-1': `${bucket}.s3-website-ap-southeast-1.amazonaws.com`,
'ap-southeast-2': `${bucket}.s3-website-ap-southeast-2.amazonaws.com`,
'ap-northeast-1': `${bucket}.s3-website-ap-northeast-1.amazonaws.com`,
'eu-central-1': `${bucket}.s3-website.eu-central-1.amazonaws.com`,
'eu-west-1': `${bucket}.s3-website-eu-west-1.amazonaws.com`,
'sa-east-1': `${bucket}.s3-website-sa-east-1.amazonaws.com`
}[region])
@fhenri
Copy link

fhenri commented Sep 13, 2016

${bucket}.s3-website-<region>.amazonaws.com is applicable for all regions, see http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region while the . notation is not. I agree the examples from your links are a bit misleading, generally it would be good that the 2 forms are always available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment