简体   繁体   中英

AWS Cloudformation Template - Set Region in S3 Bucket

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."
       }
     }
   }

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM