11
votes

I'm trying to create an s3 bucket in a specific region (us-west-2). This doesn't seem possible using Cloudformation Templates. Any ideas? I have had no luck explicitly naming it using the service-region-hash convention that i read about.

 Template:
 {
     "AWSTemplateFormatVersion": "2010-09-09",
     "Resources": {
       "S3Bucket": {
         "Type": "AWS::S3::Bucket",
         "Properties": {
           "AccessControl": "PublicReadWrite",
         }
       }
     },
     "Outputs": {
       "BucketName": {
         "Value": {
           "Ref": "S3Bucket"
         },
         "Description": "Name of the sample Amazon S3 bucket with a lifecycle configuration."
       }
     }
   }
1

1 Answers

11
votes

If you want to create the s3 bucket in a specific region, you need to run the Cloudformation JSON template from this region.

The end point URLs for cloudFormation are Region based (https://aws.amazon.com/cloudformation/faqs/?nc1=h_ls#regions and http://docs.aws.amazon.com/general/latest/gr/rande.html#cfn_region) and you cannot as for today cross check region.

I saw it has been discussed few times on aws support thread so might be something that will be done in future

The bucket is created within 1 region and when you need to access it you need to pass the region to the s3 end-point.

If you want to enable cross-region replication you can do that from the cloud formation template with the ReplicationConfiguration properties