Architect's Log

I'm a Cloud Architect. I'm highly motivated to reduce toils with driving DevOps.

【AWS Tools for PowerShell】Write-S3Objectで`The bucket you are attempting to access must be addressed using the specified endpoint.`のエラー

現象

Write-S3ObjectでThe bucket you are attempting to access must be addressed using the specified endpoint.のエラーが発生する。

> Write-S3Object -BucketName test_bucket -File test_file.txt -Key test_file.txt -ProfileName profile
Write-S3Object : The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.

原因

リージョン指定がない。

対応

リージョンを指定する。

Write-S3Object -BucketName test_bucket -File test_file.txt -Key test_file.txt -ProfileName profile -Region ap-northeast-1

セッション内でまとめて指定することもできる。

Set-DefaultAWSRegion ap-northeast-1