跳至內容

S3 Bucket Policy Doesn't Work Due to API Response Error

0

Hi!

I'm following AWS Technical Essentials - 1.1.1 Module 4's Demonstration: Creating an Amazon S3 Bucket. I want to make an S3 bucket as the lecturer, Seph, shows in the video, however, I can't save due to the error stating there's an API response error. Even after adding my information to Principal and Resource, S3 policy didn't work.

Code Chunk used

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowS3ReadAccess", "Principal": { "AWS": "arn:aws:iam::398113668163:role/S3DynamoDBFullAccessRole" }, "Effect": "Allow", "Action": "s3:", "Resource": [ "arn:aws:s3:::employee-web-app-photo-bucket-sr-001", "arn:aws:s3:::employee-web-app-photo-bucket-sr-001/" ] } ] }

Error shown

Unknown Error An unexpected error occurred. API response Invalid principal in policy

For the JSON code that the lecturer used in the demonstration, please find the attached screenshot.

What can I do to solve this issue?

Thank you so much in advance!

PHOTO: The code used in the demo

  • Hi Ryo, could you please share the full error (API response error)?

  • Hi there,

    When I typed the code chunk below, the below error message came back.

    { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowS3ReadAccess", "Principal": { "AWS": "arn:aws:iam::398113668163:role/S3DynamoDBFullAccessRole" }, "Effect": "Allow", "Action": "s3:", "Resource": [ "arn:aws:s3:::employee-web-app-photo-bucket-sr-001", "arn:aws:s3:::employee-web-app-photo-bucket-sr-001/" ] } ] }

    Unknown Error An unexpected error occurred. API response Invalid principal in policy

已提問 3 年前檢視次數 932 次

2 個答案
0

Can you provide a detailed description of the error?
I would like to see a description of the policy used as well since I can't see the images well.

專家

已回答 3 年前

  • Hi there,

    Hi there,

    When I typed the code chunk below, the below error message came back.

    { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowS3ReadAccess", "Principal": { "AWS": "arn:aws:iam::398113668163:role/S3DynamoDBFullAccessRole" }, "Effect": "Allow", "Action": "s3:", "Resource": [ "arn:aws:s3:::employee-web-app-photo-bucket-sr-001", "arn:aws:s3:::employee-web-app-photo-bucket-sr-001/" ] } ] }

    Unknown Error An unexpected error occurred. API response Invalid principal in policy

  • The action is "s3:", but this will result in an error. The following is an error if you do not describe the S3 operation required for the action. It also appears from the errors that there is a problem with the "Principal". Make sure this "arn:aws:iam::398113668163:role/S3DynamoDBFullAccessRole" exists in your AWS account. An error will occur if you do not have an IAM role. Also, please make sure that the S3 ARN listed in the resource is also changed to yours, or you will get an error.

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "AllowS3ReadAccess",
          "Principal": {
            "AWS": "arn:aws:iam::398113668163:role/S3DynamoDBFullAccessRole"
          },
          "Effect": "Allow",
          "Action": "s3:Get*",
          "Resource": [
            "arn:aws:s3:::employee-web-app-photo-bucket-sr-001",
            "arn:aws:s3:::employee-web-app-photo-bucket-sr-001/*"
          ]
        }
      ]
    }
    
0

Hi Riku_Kobayashi,

Thank you SO MUCH for sharing tips here! I apologize for such a delayed response... I was locked out and unable to log in to my account.

I'll try what you recommended above. Thanks very much again. Ryo

已回答 3 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。