Search code examples
amazon-web-servicesamazon-amiquantum-computingqiskit

AWS braket python sdk: user is not authorized to perform on quantum device


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

Solution

  • 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