![](/img/trans.png)
[英]AWS CloudFront distribution with multiple s3 buckets in different regions
[英]AWS S3 buckets creation in different regions using Terraform
嘗試在提供程序聲明中提到的區域以外的不同區域創建 S3 存儲桶時出現以下錯誤。
錯誤:創建 S3 存儲桶時出錯:IllegalLocationConstraintException:eu-central-1 位置約束與此請求發送到的區域特定端點不兼容。 狀態碼:400,請求 ID:CDC41B1AC8DECE02,主機 ID:rZq1QatrmMLJ4pKfM5Ry5vg2asFYOGTJJNVVquXgnr3L506hHpFZf67YOiatapSc3UGtYntQsbU=
解決方案:似乎根據 AWS 文檔https://docs.aws.amazon.com/cli/latest/reference/s3api/create-bucket.html ,還需要提及 LocationConstraint。
$ aws s3api create-bucket --bucket my-bucket --region eu-west-1 --create-bucket-configuration LocationConstraint=eu-west-1
However, I don't see that equivalent configuration parameter in the Terraform code documentation https://www.terraform.io/docs/providers/aws/r/s3_bucket.html . 我使用最新的 Terraform 版本:0.12.3
樣品 Terraform 代碼:
resource "aws_s3_bucket" "public-alb-logs-bucket" {
bucket = "alb-access-logs-prod"
region = "eu-central-1"
}
provider "aws" {
version = "~> 2.14.0"
region = "us-west-2"
}
如果兩個區域相同,則相同的代碼有效。 (在 S3 資源和提供程序部分)。
任何幫助/想法將不勝感激。 謝謝。 如果有任何其他信息,也請告訴我。
我無法確認,但我認為問題在於您的地區不匹配:
resource "aws_s3_bucket" "public-alb-logs-bucket" {
bucket = "alb-access-logs-prod"
region = "eu-central-1" ### This region is different from the one below
}
provider "aws" {
version = "~> 2.14.0"
region = "us-west-2" ### This region is different from the one above
}
我目前與不同地區的賬戶和在多個地區擁有資源的賬戶合作。 但我從未嘗試使用與資源區域不匹配的提供程序區域來部署資源。
所以我猜這是問題所在??
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.