6
2

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 5 years have passed since last update.

[aws][beanstalk]ELB向けs3の設定

Last updated at Posted at 2019-02-23

※作成中

#1. ロードバランサからs3にアクセスログを書き込む

発生する問題

s3の権限設定を行わないと、ロードバランサにs3を指定した際にElastic Beanstalk等で以下のようなエラーが発生するのでポリシーの設定方法を記載しておく

Beanstalkで生成時のエラー
Updating load balancer named:
 arn:aws:elasticloadbalancing:ap-northeast-1:XXXXXXXXX:loadbalancer/app/awseb-AWSEB-XXXXXXXXX/XXXXXXXXXXXXXX
failed Reason: 
  Access Denied for bucket: beanstalk-web-logs. 
  Please check S3bucket permission (Service: AmazonElasticLoadBalancingV2;
  Status Code: 400;
  Error Code: InvalidConfigurationRequest; Request ID: XXXXX

生成方法と前提となる対象

バケット設定
backet-name: beanstalk-web-logs
リージョン: ap-northeast-1
Elastic Load Balancing アカウント ID: 582318560864

s3のポリシーを設定する際に、ポリシージェネレータを利用してJSONを生成すること
プリンシパルに関しては、「Elastic Load Balancing アカウント ID」を設定すること(詳細はロードバランサのマニュアル参照)

生成したポリシーのJSON

backet-policy
{
  "Id": "Policy1429136655940",
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1429136633762",
      "Action": [
        "s3:PutObject"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::beanstalk-web-logs/my-app/AWSLogs/123456789012/*",
      "Principal": {
        "AWS": [
          "582318560864"
        ]
      }
    }
  ]
}

6
2
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
6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?