The pattern of the bucket is ${bucket}.s3-website-<region>.amazonaws.com
(This is the more general form and is applicable for all regions, see http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region, while the form ${bucket}.s3-website.<region>.amazonaws.com
is not applicable for all regions)
If you want to find out the region name of your bucket you can use the following command
aws s3api get-bucket-location --bucket <your-bucket>
you will get
{
"LocationConstraint": null
}
This means your bucket has been created in us-east-1
or for any other region you'll get the region name correctly
{
"LocationConstraint": "eu-central-1"
}
To complement if you really want to build a list of available endpoints, the AWS SDSK (s3
or s3api
) does not provide this list (as of today)
The closest you could get using the CLI is to get the list from the ec2 regions. It will assume that when there is a new region where ec2 is deployed, s3 is deployed as well (I cannot guarantee it will not be the case one day but for now its a faire assumption to say if there's a new region ec2 and s3 are at least the services aws will deploy)
so you can run
$ aws ec2 describe-regions
{
"Regions": [
{
"Endpoint": "ec2.ap-south-1.amazonaws.com",
"RegionName": "ap-south-1"
},
{
"Endpoint": "ec2.eu-west-1.amazonaws.com",
"RegionName": "eu-west-1"
},
{
"Endpoint": "ec2.ap-southeast-1.amazonaws.com",
"RegionName": "ap-southeast-1"
},
{
"Endpoint": "ec2.ap-southeast-2.amazonaws.com",
"RegionName": "ap-southeast-2"
},
{
"Endpoint": "ec2.eu-central-1.amazonaws.com",
"RegionName": "eu-central-1"
},
{
"Endpoint": "ec2.ap-northeast-2.amazonaws.com",
"RegionName": "ap-northeast-2"
},
{
"Endpoint": "ec2.ap-northeast-1.amazonaws.com",
"RegionName": "ap-northeast-1"
},
{
"Endpoint": "ec2.us-east-1.amazonaws.com",
"RegionName": "us-east-1"
},
{
"Endpoint": "ec2.sa-east-1.amazonaws.com",
"RegionName": "sa-east-1"
},
{
"Endpoint": "ec2.us-west-1.amazonaws.com",
"RegionName": "us-west-1"
},
{
"Endpoint": "ec2.us-west-2.amazonaws.com",
"RegionName": "us-west-2"
}
]
}
you can then apply the pattern ${bucket}.s3-website-<RegionName>.amazonaws.com