Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix S3 bucket policy example to prevent "action does not apply to any resources in statement" error #7799

Open
mkdev10 opened this issue Jul 3, 2024 · 0 comments
Labels
storage Amplify Storage

Comments

@mkdev10
Copy link

mkdev10 commented Jul 3, 2024

Describe the content issue:
I encountered an error when executing a policy in the AWS Console, which states "action does not apply to any resources in statement." I propose a correction to resolve this issue.

The existing policy example is:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Statement1",
            "Principal": { "AWS": "arn:aws:iam::<AWS-account-ID>:role/<role-name>" },
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject",
                "s3:DeleteObject",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::<bucket-name>/*"
            ]
        }
    ]
}

I receive an error saying "action does not apply to any resources in statement."

I propose the following correction:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Statement1",
            "Principal": { "AWS": "arn:aws:iam::<AWS-account-ID>:role/<role-name>" },
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject",
                "s3:DeleteObject",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::<bucket-name>",
                "arn:aws:s3:::<bucket-name>/*"
            ]
        }
    ]
}

By implementing this correction, it is expected that the number of people encountering this error will be reduced.

URL page where content issue is:
https://docs.amplify.aws/react/build-a-backend/storage/use-with-custom-s3/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
storage Amplify Storage
Projects
None yet
Development

No branches or pull requests

2 participants