AWS re:Post을(를) 사용하면 다음에 동의하게 됩니다. AWS re:Post 이용 약관

Access Denied (Service: S3, Status Code: 403)

0

Hi All,

As i try to run the nested stack for creating of s3 bucket its shows below error message Resource handler returned message: Access Denied (Service: S3, Status Code: 403), not sure what is wrong in template { "AWSTemplateFormatVersion": "2010-09-09", "Parameters": { "BucketName": { "Type": "String", "Description": "" }, "GL": { "Type": "String", "Default": "", "Description": "Tag" }, "Owner": { "Type": "String", "Default": "", "Description": "Tag Owner" }, "ApID": { "Type": "String", "Default": "", "Description": "Tag Application ID" } }, "Resources": { "S3Bucket": { "Type": "AWS::S3::Bucket", "Properties": { "BucketName": { "Fn::Sub": "<bucketname>" }, "AccessControl": "Private", "Tags": [ { "Key": "GBL", "Value": { "Ref": "GL" } }, { "Key": "Owner", "Value": { "Ref": "Owner" } }, { "Key": "ApplicationID", "Value": { "Ref": "ApID" } }, { "Key": "Name", "Value": { "Fn::Sub": "<bucketname>" } } ], "PublicAccessBlockConfiguration": { "BlockPublicAcls": true, "BlockPublicPolicy": true, "IgnorePublicAcls": true, "RestrictPublicBuckets": true }, "OwnershipControls": { "Rules": [ { "ObjectOwnership": "ObjectWriter" } ] } } } }, "Outputs": { "BucketName": { "Description": "", "Value": { "Ref": "BucketName" }, "Export": { "Name": { "Fn::Sub": "${AWS::StackName}-BUCKET-NAME" } } }, "ALBIPBUCKETNAME": { "Value": { "Ref": "S3Bucket" } } } }

Admin
질문됨 한 달 전181회 조회
1개 답변
1

Hello.

I was able to create an S3 bucket using the template below in my AWS account.
If the error content is "Access Denied", I thought that the IAM policy for creating S3 might not be attached to the IAM user.
By the way, can I create S3 if I deploy a CloudFormation template that creates S3 directly instead of from a nested stack?
Also, if you look at the CloudTrail event history, you can check the API event where the error occurred, so please check it.
https://docs.aws.amazon.com/awscloudtrail/latest/userguide/view-cloudtrail-events-console.html

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Parameters": {
        "BucketName": {
            "Type": "String",
            "Description": ""
        },
        "GL": {
            "Type": "String",
            "Default": "",
            "Description": "Tag"
        },
        "Owner": {
            "Type": "String",
            "Default": "",
            "Description": "Tag Owner"
        },
        "ApID": {
            "Type": "String",
            "Default": "",
            "Description": "Tag Application ID"
        }
    },
    "Resources": {
        "S3Bucket": {
            "Type": "AWS::S3::Bucket",
            "Properties": {
                "BucketName": {
                    "Ref": "BucketName"
                },
                "AccessControl": "Private",
                "Tags": [
                    {
                        "Key": "GBL",
                        "Value": {
                            "Ref": "GL"
                        }
                    },
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "Owner"
                        }
                    },
                    {
                        "Key": "ApplicationID",
                        "Value": {
                            "Ref": "ApID"
                        }
                    },
                    {
                        "Key": "Name",
                        "Value": {
                            "Ref": "BucketName"
                        }
                    }
                ],
                "PublicAccessBlockConfiguration": {
                    "BlockPublicAcls": true,
                    "BlockPublicPolicy": true,
                    "IgnorePublicAcls": true,
                    "RestrictPublicBuckets": true
                },
                "OwnershipControls": {
                    "Rules": [
                        {
                            "ObjectOwnership": "ObjectWriter"
                        }
                    ]
                }
            }
        }
    },
    "Outputs": {
        "BucketName": {
            "Description": "",
            "Value": {
                "Ref": "BucketName"
            },
            "Export": {
                "Name": {
                    "Fn::Sub": "${AWS::StackName}-BUCKET-NAME"
                }
            }
        },
        "ALBIPBUCKETNAME": {
            "Value": {
                "Ref": "S3Bucket"
            }
        }
    }
}
profile picture
전문가
답변함 한 달 전
profile picture
전문가
검토됨 한 달 전
  • PutBucketPublicAccessBlock is the event name shown in cloud trial, but i have s3 full access

  • Can I check the event history details to see if any errors have occurred? Is it possible to try directly deploying a CloudFormation template that creates S3 rather than a nested stack? Also, if your AWS account is managed by AWS Organizations, please check if there are any policies set such as SCP that block S3 creation.

  • Most likely, there's an SCP in the Organizations org that blocks PutBucketPublicAccessBlock from being called. Your organisation admins may have set the limitation to ensure no one creates publicly accessible buckets (even though in this case, you're trying to set the most restrictive setting at the bucket level). If that's so, then just remove the PBA settings from your template.

관련 콘텐츠