简体   繁体   English

如何使用 AccountB 的用户 CLI 凭证从 AccountA 访问 DynamoDB 表?

[英]How can I access DynamoDB table from AccountA with using AccountB's User CLI credentials?

I have created one table in Dynamodb and setup role in IAM with following policy attached:我在 Dynamodb 中创建了一个表,并在 IAM 中设置了角色,并附加了以下策略:

{
  "Version": "2012-10-17",
  "Statement": [{
        "Effect": "Allow",
        "Action": "dynamodb:*",
        "Resource": "arn:aws:dynamodb:ap-south-1:**AccountAID**:table/employee"
  }]
}

I have added trusted entity AccountB ID in the role.我在角色中添加了可信实体 AccountB ID。 Then I have also created policy in AccountB for the access of dynamodb table created in AccountA with following policy:然后我还在 AccountB 中创建了策略,用于访问在 AccountA 中创建的 dynamodb 表,其策略如下:

{
    "Version": "2012-10-17",
    "Statement": [{
            "Effect": "Allow",
            "Action": "*",
            "Resource": "arn:aws:iam::**AccountAID**:role/DynamodbCrossAccountAccessRole"
    }]
}

I have configured profiles of AccountA user and AccountB user and with the credentials of AccountA's profile user, I can list tables of dynamodb but while trying to get with AccountB's profile user I always returns with empty-table list.我已经配置了 AccountA 用户和 AccountB 用户的配置文件,并且使用 AccountA 的配置文件用户的凭据,我可以列出 dynamodb 的表,但是在尝试使用 AccountB 的配置文件用户时,我总是返回空表列表。

Krunal-MacBook-Air:.aws krunal$ aws dynamodb list-tables --profile Krunal { "TableNames": [ "employee" ] } Krunal-MacBook-Air:.aws krunal$ aws dynamodb list-tables --profile Krunal2 { "TableNames": [] }

Can anyone help me out of this why am I not able to access dynamodb with AccountB's profile?谁能帮我解决这个问题,为什么我无法使用 AccountB 的个人资料访问 dynamodb? Policies are attached to the account users respectively.策略分别附加到帐户用户。

Based on the comments.根据评论。

The issue was solved by assuming the role in AccountB.通过担任 AccountB 中的角色解决了该问题。 The useful links showing how to do this are:显示如何执行此操作的有用链接是:

Based on the comments and with the help of provided documents, I can access to my AccountB's resources.根据评论并在提供的文件的帮助下,我可以访问我的 AccountB 的资源。 I have configured generated API Key, Secret Key and Tokens in credentials file of my profile and it's working as expected.我已经在我的个人资料的凭证文件中配置了生成的 API 密钥、密钥和令牌,并且它按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 dynamodb 中使用两个不同的凭据来拥有只读用户和所有访问用户? - How can I use two different credentials with dynamodb to have a readonly user and an all access user? 如何以访客用户身份访问AWS DynamoDB? - How can I access an AWS DynamoDB as a guest user? 我可以使用导出/导入到 S3 将数据从 AWS DynamoDB 迁移到新的全局表吗 - Can I migrate data from an AWS DynamoDB to a new Global Table using export/import to S3 如何使用 Javascript 访问和更新云中的 AWS DynamoDB 表? - How can I access and update an AWS DynamoDB table in the cloud using Javascript? 使用 AWS CLI 将文件从本地上传到 s3,无需硬编码凭证(访问 ID 和秘密访问密钥) - upload file to s3 from local using AWS CLI without hard-coded credentials(access id and secret access key) 如何将用户的操作保存到DynamoDB中? - How I can save user's actions logging to DynamoDB? 我可以使用 lambda 将数据从 s3 导出到 dynamoDB 吗? - Can I export data from s3 to dynamoDB using lambda? 如何在 DynamoDb 中加入两个表? - How I can join two table in DynamoDb? 如何将数组存储到 dynamoDB 表中 - How can I store an array into dynamoDB table 如何从 C# 访问 AWS CLI 资源? - How can I access AWS CLI resources from C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM