是否可以向AWS Policy添加内联描述?

时间:2022-04-02 23:07:47

I have an S3 bucket policy in AWS to control access via IP, as per their standard examples, & would like to be able to add a comment or description inline (in the interest of keeping documentation as close to the implementation as possible).

我在AWS中有一个S3存储桶策略来控制通过IP访问,根据他们的标准示例,并且希望能够内联添加注释或描述(为了使文档尽可能接近实现)。

If I try to add a custom field, e.g. Description, I'll get a validation error on save — "Invalid policy element - Description".

如果我尝试添加自定义字段,例如说明,我将在保存时收到验证错误 - “无效的策略元素 - 描述”。

I can find this reference to the grammar of required elements, but can't seem to find any info on whether there are any optional fields allowed at all by the schema, & if so what they are.

我可以找到这个对所需元素的语法的引用,但似乎无法找到关于模式是否允许任何可选字段的任何信息,如果是的话,它们是什么。

Is it possible to add any fields to give an overview of the policy inline?

是否可以添加任何字段以概述内联策略?

{
  "Version": "2012-10-17",
  "Id": "S3PolicyId1",
  "Statement": [
    {
      "Sid": "IPAllow",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:*",
      "Resource": "arn:aws:s3:::examplebucket/*",
      "Condition": {
         "IpAddress": {"aws:SourceIp": "54.240.143.0/24"},
         "NotIpAddress": {"aws:SourceIp": "54.240.143.188/32"} 
      } 
    } 
  ]
}

1 个解决方案

#1


From the page you cited, Sid is probably what you want to use for this. It's largely freeform, but you probably want to use underscores where you might otherwise use spaces.

从你引用的页面来看,Sid可能就是你想要用的。它基本上是*形式的,但您可能希望使用下划线,否则您可能会使用空格。

sid_string

Provides a way to include information about an individual statement. Some services require this value to be unique within an AWS account. Some services allow spaces in the Sid value, and others do not.

提供包含有关单个语句的信息的方法。某些服务要求此值在AWS账户中是唯一的。某些服务允许Sid值中的空格,而其他服务则不允许。

"Sid": "ThisStatementProvidesPermissionsForConsoleAccess"

#1


From the page you cited, Sid is probably what you want to use for this. It's largely freeform, but you probably want to use underscores where you might otherwise use spaces.

从你引用的页面来看,Sid可能就是你想要用的。它基本上是*形式的,但您可能希望使用下划线,否则您可能会使用空格。

sid_string

Provides a way to include information about an individual statement. Some services require this value to be unique within an AWS account. Some services allow spaces in the Sid value, and others do not.

提供包含有关单个语句的信息的方法。某些服务要求此值在AWS账户中是唯一的。某些服务允许Sid值中的空格,而其他服务则不允许。

"Sid": "ThisStatementProvidesPermissionsForConsoleAccess"