AWS Braket Python SDK:无权在量子设备上执行用户

发布于 2025-02-11 17:22:02 字数 1787 浏览 3 评论 0 原文

我已经安装了Boto3,AWS CLI和Python-Braket-SDK。我已经运行 aws配置,并与我的IAM用户进行配置。我的IAM用户不是root用户,但是它具有 abtifyAccess amazonbraketfullaccess amazynbraketjobsexecutionpolicypolicy 策略。

但是,如果我试图通过此命令获取一些量子设备: aws braket get-device-device-arn arn:aws:aws:braket ::: device/qpu/qpu/ionq/ionqdevice error:

An error occurred (AccessDeniedException) when calling the GetDevice operation: User: arn:aws:iam::178363055402:user/hblab-rnd is not authorized to perform: braket:GetDevice on resource: arn:aws:braket :: 178363055402:设备/qpu/ionq/ionq/ionqdevice,具有显式拒绝

如果我从此链接下方在python下运行相同的 python#用法“ rel =” nofollow noreferrer“> https://github.com/aws/amazon-braket-sdk-python#usage ,它也返回类似的错误:

import boto3
from braket.aws import AwsDevice
from braket.circuits import Circuit
device = AwsDevice("arn:aws:braket:::device/quantum-simulator/amazon/sv1")
bell = Circuit().h(0).cnot(0, 1)
task = device.run(bell, shots=100)
print(task.result().measurement_counts)

错误输出:

AccessDeniedException: An error occurred (AccessDeniedException) when calling the GetDevice 
operation: User: arn:aws:iam::178363055402:user/hblab-rnd is not authorized to perform: 
braket:GetDevice on resource: arn:aws:braket::178363055402:device/quantum-simulator/amazon/sv1 
with an explicit deny

我已经添加架设,但我无法弄清楚此错误的原因。请帮助

系统信息

  • aws cli :aws-cli/2.7.11 python/3.9.11 Windows/10 exe/amd64提示/off
  • :1.25.2
  • 亚马逊式架构:1.10.0
  • Amazon Braket默认模拟器:1.6.2
  • Python版本:3.8.13

I have installed boto3, aws cli, and python-braket-sdk. I have run aws configure, and config with my IAM user. My IAM user isn't root user, but it has AdministratorAccess, AmazonBraketFullAccess, AmazonBraketJobsExecutionPolicy policies.

But if I tried to get some quantum device by this command:aws braket get-device --device-arn arn:aws:braket:::device/qpu/ionq/ionQdevice, it always return this error:

An error occurred (AccessDeniedException) when calling the GetDevice operation: User: arn:aws:iam::178363055402:user/hblab-rnd is not authorized to perform: braket:GetDevice on resource: arn:aws:braket::178363055402:device/qpu/ionq/ionQdevice with an explicit deny

If I run same below python from this link: https://github.com/aws/amazon-braket-sdk-python#usage, it also return similar error:

import boto3
from braket.aws import AwsDevice
from braket.circuits import Circuit
device = AwsDevice("arn:aws:braket:::device/quantum-simulator/amazon/sv1")
bell = Circuit().h(0).cnot(0, 1)
task = device.run(bell, shots=100)
print(task.result().measurement_counts)

Error output:

AccessDeniedException: An error occurred (AccessDeniedException) when calling the GetDevice 
operation: User: arn:aws:iam::178363055402:user/hblab-rnd is not authorized to perform: 
braket:GetDevice on resource: arn:aws:braket::178363055402:device/quantum-simulator/amazon/sv1 
with an explicit deny

I have already added permissions for Braket, but I can not figure the reason for this bug. Please help

System information

  • aws cli: aws-cli/2.7.11 Python/3.9.11 Windows/10 exe/AMD64 prompt/off
  • Amazon Braket Python SDK version: 1.25.2
  • Amazon Braket schemas: 1.10.0
  • Amazon Braket default simulator: 1.6.2
  • Python version: 3.8.13

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

临风闻羌笛 2025-02-18 17:22:02

我找到了答案。我已经在我的帐户上激活了MFA授权,但是在我的 aws cli 中,我不设置它。因此,我需要通过没有MFA的新帐户设置 aws cli ,或为我的 aws cli 设置MFA。谢谢大家的帮助

I have found the answer. I have activated MFA authorization on my account, but in my aws cli, I don't setup it. So I need to setup my aws cli by a new account without MFA, or set up MFA for my aws cli. Thank you everyone for help

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文