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"-
有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 SetIdentityPoolRoles
。
-
- 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。
-
ListIdentityPools
UpdateIdentityPool