0
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?

【S3】オブジェクトURLにアクセスしても画像が表示されない

Posted at

現象

S3にアップロードした画像のオブジェクトに移動し、オブジェクトURLにアクセスしても下記のように表示されてしまい、画像が表示されない。

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>FDNGTP38N87SEYB9</RequestId>
<HostId>IYV4WCW2cNiFmQIiJmHJbSgtdlJzq2cqz/UQ2E9RmEN6/1QFtBFOxvQMyhtl133IvyDLOkRQsM4=</HostId>
</Error>

WP Offload Mediaプラグインを使用して、WordPressから画像を投稿したら、S3に保存されるようにし、画像の配信もS3から行うようにしている。
このとき、画像を投稿すると、編集画面で「画像にalt属性が指定されていません。」と表示され、正常に画像が表示されない。

対処

下記のコードをコピーする

        {
            "Sid": "Read",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": "arn:aws:s3:::{自分のバケット名}/*"
        }

S3のバケットのバケットポリシーで編集をクリックし、上記のコードを貼り付ける
FireShot Capture 091 - aws-and-infra-wp21301 - S3 バケット - S3 - ap-northeast-1_ - [ap-northeast-1.console.aws.amazon.com].png

0
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
0
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?