0
$\begingroup$

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
$\endgroup$

2 Answers 2

1
$\begingroup$

I wasn't able to reproduce this at my end looks like something incorrect with IAM configuration. Can you try using the command rm -rf .aws to remove the current credentials and then performing the aws configure command once more with a new access ID and key for the same user with attached policies?

And then try running aws braket get-device --device-arn arn:aws:braket:::device/qpu/ionq/ionQdevice. Also make sure to set Default region name as us-east-1 before running this command.

$\endgroup$
1
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.