3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

S3の権限を限定したIAMを使いWinSCPするときの注意点

Posted at

WinSCPはバージョン5.13からS3への接続にも対応するようになっているが。

アクセスできるバケットを制限したIAMでWinSCPで利用しようとしたらエラーになったのでメモ。

今回利用した環境

  • Windows 10 21H1
  • WinSCP 5.19.5

今回起こった事象

下記のような指定されたバケットのみ、list,put,get,deleteができるようなポリシーを持ったIAMユーザの資格情報でWinSCPで接続しようとしたらエラーになった

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "s3:ListBucket",
            "Resource": "arn:aws:s3:::バケット名"
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject",
                "s3:DeleteObject"
            ],
            "Resource": [
                "arn:aws:s3:::バケット名/*"
            ]
        }
    ]
}

アクセスキーとシークレットキーを入力してログインしようとした所

image.png

エラーが発生

image.png

なんとなく実行する前から、バケットをリストできないけどどう動作するの? って感じがありましたが。
案の定エラー。

WinSCPのドキュメントを確認した所、下記ページに記載がありました。

Connecting to Amazon S3 service

IAMにバケットをリストする権限がない場合では、リモートディレクトリの設定でバケットを指定する必要がありそうです。

リモートディレクトリにバケット名を指定

リモードディレクトリにバケット名を指定して、アクセスするバケットを指定します。

設定を選択

image.png

環境 ー> ディレクトリ ー> リモートディレクトリにバケット名を設定して OK選択

image.png

リモートディレクトリにバケット名を指定した状態であらためてログインをしてみると、先程のエラーが解消された事を確認できます。

image.png

総評

ガイドを見るとそのものズバリのケースについて記載がありました。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?