将 SetIdentityPoolRoles 与 CLI 配合使用 - AWS SDK 代码示例

AWS 文档 SDK 示例 GitHub 存储库中还有更多 AWS SDK 示例。

SetIdentityPoolRoles 与 CLI 配合使用

以下代码示例演示如何使用 SetIdentityPoolRoles

CLI
AWS CLI

设置身份池角色

以下 set-identity-pool-roles 示例设置身份池角色。

aws cognito-identity set-identity-pool-roles \ --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111" \ --roles authenticated="arn:aws:iam::111111111111:role/Cognito_MyIdentityPoolAuth_Role"
PowerShell
Tools for PowerShell V4

示例 1:将特定的身份池配置为具有未经身份验证的 IAM 角色。

Set-CGIIdentityPoolRole -IdentityPoolId us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1 -Role @{ "unauthenticated" = "arn:aws:iam::123456789012:role/CommonTests1Role" }
  • 有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V4)》中的 SetIdentityPoolRoles

Tools for PowerShell V5

示例 1:将特定的身份池配置为具有未经身份验证的 IAM 角色。

Set-CGIIdentityPoolRole -IdentityPoolId us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1 -Role @{ "unauthenticated" = "arn:aws:iam::123456789012:role/CommonTests1Role" }
  • 有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V5)》中的 SetIdentityPoolRoles