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

Is it possible to add an inline description to an AWS Policy?

我在 AWS 中有一个 S3 存储桶策略来控制通过 IP 的访问,as per their standard examples,并且希望能够添加内联评论或描述(为了使文档尽可能接近实施尽可能)。

如果我尝试添加自定义字段,例如Description,我会在保存时收到验证错误 — "Invalid policy element - Description".

我可以 find this reference 了解必需元素的语法,但似乎找不到任何关于模式是否允许任何可选字段的信息,如果是的话,它们是什么。

是否可以添加任何字段以提供内嵌政策的概览?

{
  "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"} 
      } 
    } 
  ]
}

根据您引用的页面,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.

"Sid": "ThisStatementProvidesPermissionsForConsoleAccess"