# 资源策略(Resource-based policies)示例策略

{% embed url="<https://github.com/aws-samples/data-perimeter-policy-examples/tree/main/resource_based_policies>" %}

Resource-based policies定义了哪些 IAM 主体（包括 SLR 和亚马逊云服务主体）可以与资源交互，以及可以从哪些预期的网络进行访问。这意味着除了通过基于身份的策略进行授权之外，这些资源还可以定义与资源直接关联的访问策略。资源策略通常用于提供跨账户访问，并可用于授权外部亚马逊云凭证或匿名访问。尽管在默认情况下，基于资源的策略不允许意外访问，但配置错误的策略可能会无意中授予对意外的主体或意外的网络的访问权限。有关支持基于资源的策略的服务列表，请参阅[ 与 IAM 配合使用的亚马逊云服务](https://docs.amazonaws.cn/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html) 。

基于资源的策略主要使用aws:PrincipalOrgId和aws:PrincipalIsAWSService条件来实现仅可信身份访问，使用 aws:SourceIp、aws:SourceVpc  、aws:ViaAWSService和 aws:PrincipalIsAWSService 条件来实现**仅预期的网络**访问，并且管理策略中所需的例外规则。有关更多详情，请参阅[数据边界策略示例存储库](https://github.com/aws-samples/data-perimeter-policy-examples)中的[基于资源的策略](https://github.com/aws-samples/data-perimeter-policy-examples/tree/main/resource_based_policies) 。&#x20;

| Title                                                                                                                                                                                                                                                             | Note                         |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
| [IAM Role Trust Policy](https://aws-gcr-wwso-security.gitbook.io/an-quan-zui-jia-shi-jian/1.-iam-shen-fen-shi-bie-yu-fang-wen-kong-zhi/data-perimeters-shu-ju-fang-hu-bian-jie/zi-yuan-ce-le-resourcebased-policies-shi-li-ce-le/iam-role-trust-policy)           | 给IAM Role添加信任策略时使用的策略。       |
| [S3存储桶策略](https://aws-gcr-wwso-security.gitbook.io/an-quan-zui-jia-shi-jian/1.-iam-shen-fen-shi-bie-yu-fang-wen-kong-zhi/data-perimeters-shu-ju-fang-hu-bian-jie/zi-yuan-ce-le-resourcebased-policies-shi-li-ce-le/s3-cun-chu-tong-ce-le)                         | S3存储桶策略建议添加的权限控制内容。          |
| [KMS key策略](https://aws-gcr-wwso-security.gitbook.io/an-quan-zui-jia-shi-jian/1.-iam-shen-fen-shi-bie-yu-fang-wen-kong-zhi/data-perimeters-shu-ju-fang-hu-bian-jie/zi-yuan-ce-le-resourcebased-policies-shi-li-ce-le/kms-key-ce-le)                               | 给KMS key添加的策略                |
| [Secrets Manager Secret策略](https://aws-gcr-wwso-security.gitbook.io/an-quan-zui-jia-shi-jian/1.-iam-shen-fen-shi-bie-yu-fang-wen-kong-zhi/data-perimeters-shu-ju-fang-hu-bian-jie/zi-yuan-ce-le-resourcebased-policies-shi-li-ce-le/secrets-manager-secret-ce-le) | 给Secrets Manager Secret添加的策略 |
| [SNS策略](https://aws-gcr-wwso-security.gitbook.io/an-quan-zui-jia-shi-jian/1.-iam-shen-fen-shi-bie-yu-fang-wen-kong-zhi/data-perimeters-shu-ju-fang-hu-bian-jie/zi-yuan-ce-le-resourcebased-policies-shi-li-ce-le/sns-ce-le)                                       | 给SNS的资源策略                    |
| [SQS队列策略](https://aws-gcr-wwso-security.gitbook.io/an-quan-zui-jia-shi-jian/1.-iam-shen-fen-shi-bie-yu-fang-wen-kong-zhi/data-perimeters-shu-ju-fang-hu-bian-jie/zi-yuan-ce-le-resourcebased-policies-shi-li-ce-le/sqs-dui-lie-ce-le)                             | 给SQS队列的资源策略                  |
