我正在使用 cloudformation cli 創建一個 Cloudformation Resource Provider。
在呼叫 CreateBucket 操作時發生了一個錯誤(IllegalLocationConstraintException)。US-EAST-2的位置約束與該請求被發送到的特定區域端點不兼容。
我的代碼看起來如下:
s3 = session.client("s3")
s3.create_bucket(Bucket='mybucket123',CreateBucketConfiguration={'LocationConstraint': 'us-east-2'})
我也試過其他地區,也試過不使用LocationConstraint,我得到了同樣的錯誤,并出現了undefined,其中地區代碼是:
s3 = session.client("s3")
s3.create_bucket(Bucket='mybucket123')
cfn test實際上是使用sam local start-lambda在sam local中運行代碼,所以我有點困惑,為什么我在這里需要一個區域?
有什么想法嗎?
uj5u.com熱心網友回復:
你的client也必須被設定為你想要的區域:
s3 = session.client("s3", region_name='us-east-2')
s3.create_bucket(Bucket='mybucket123',CreateBucketConfiguration={'LocationConstraint': 'us-east-2'})
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/330517.html
標籤:
上一篇:如何使用換行在串列視圖中顯示容器
