简体   繁体   English

如何创建 AWS 访问点策略,而不会收到“错误策略具有无效资源”?

[英]How do I create an AWS Access Point Policy, without getting "Error Policy has invalid resource"?

Using使用

$ aws s3 mb s3://freds-321-pizza
make_bucket: freds-321-pizza

to successfully create a bucket.成功创建存储桶。 Using AWS Console使用 AWS 控制台

  1. create access point, name - freds-access-point创建访问点,名称 - freds-access-point
  2. check inte.net box检查互联网框
  3. "block all public access" - tried with this on and off “阻止所有公共访问” - 尝试打开和关闭
  4. ARN - created [arn:aws:s3:us-east-1:************:accesspoint/freds-access-point ARN - 创建 [arn:aws:s3:us-east-1:************:accesspoint/freds-access-point
  5. Submit "Create Access Point"提交“创建接入点”
  6. Successfully created access point: freds-access-point成功创建访问点:freds-access-point

Go back into Access Point and Edit Policy, as follows; Go 回到Access Point 并编辑Policy,如下;

{ 
   "Version": "2012-10-17", 
   "Statement": [ 
     { 
       "Action": ["s3:GetObject","s3:PutObject"], 
       "Effect": "Allow", 
       "Principal": {"AWS": ["*"]}, 
       "Resource": ["arn:aws:s3:::freds-321-pizza/*"] 
     } 
   ] 
 }

Getting "Error Policy has invalid resource" , please help?获取“错误策略具有无效资源” ,请帮忙?

Note: AWS CLI;注意:AWS CLI; --doesn't work --不起作用

aws s3control get-access-point --name freds-access-point --account-id ************

Will update when I find the right command.当我找到正确的命令时会更新。

This is beacause you're giving the S3 Bucket ARN, not the actual resources you want to attach to the policy.这是因为您提供的是 S3 存储桶 ARN,而不是您要附加到策略的实际资源。 Objects within the S3 are the actual resources you look for. S3 中的对象是您要查找的实际资源。

Your Resource should look something like this:您的资源应如下所示:

"Resource": "arn:aws:s3:zone:account_ID:accesspoint/access-point-name/object/*"

/object/ /目的/

Hope this was helpful!希望这对您有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS S3 错误“策略具有无效资源” - AWS S3 Error 'Policy has invalid resource' 如何使用 AWS CLI 创建策略 - How to create a policy using the AWS CLI 如何设置访问点策略以允许我的 web 服务器访问 S3 存储桶中的对象: - How do I set up the Access Point Policy to allow my web server to access objects in S3 Bucket: AWS 资源策略中的条件不允许 lambda 访问 Secrets Manager Secret - Condition in AWS resource policy not allowing lambda to access Secrets Manager Secret API 网关上的 AWS 资源策略 - AWS Resource policy on API Gateway 在 terraform 上创建参数化资源策略 - Create parameterized resource policy on terraform 无法为 AWS ECR 创建策略 - Unable to Create Policy for AWS ECR 如何为步进缩放的 aws_autoscaling_policy 编写 terraform 以设置容量单位? - How do I write the terraform for an aws_autoscaling_policy for Step Scaling to set capacity units? 如何创建在 Python CDK 中引用自身的 API 网关资源策略? - How to create API Gateway Resource Policy that references itself in the Python CDK? 当我尝试将 node.js AWS S3“createPresignedPost”与“元数据”一起使用时,出现“根据策略无效”错误响应 - I got 'Invalid according to Policy' error respo se when I try to use node.js AWS S3 'createPresignedPost' with 'metadata'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM