Execution on Amazon Braket Cloud¶
The Classiq executor supports execution on Amazon Braket's cloud simulators and hardware.
Tip
Backends may sometimes be unavailable. Check the availability windows with Amazon Braket.
Usage¶
Execution on Amazon Braket requires an AWS account, and a role that Classiq can assume for execution.
from classiq.execution import AwsBackendPreferences
preferences = AwsBackendPreferences(
backend_name="Name of requested simulator or hardware",
aws_role_arn="ARN of the CrossAccountRoleForBraket role",
s3_bucket_name="S3 bucket name to save the results",
s3_folder="The folder path within the S3 bucket, where the results will be saved",
job_timeout="Timeout for execution (Optional)",
)
Initial Account Setup¶
Before first use, the Classiq platform needs your permissions to connect to your AWS account. This is done by creating a cross-account role.
We provide you with the attached CloudFormation AssumeRole.cf.yaml
file.
Deploying it to your account will create the cross-account role that only
Classiq can use, and it only has the permissions needed for Braket.
To deploy the CloudFormation file, please follow the following instructions:
- Download the AssumeRole.cf.yaml file
- Install AWS CLI
- Contact Classiq support to obtain the parameters:
CORRECT_TRUSTED_ACCOUNT
CORRECT_EXTERNAL_ID_VALUE
- Execute the following command:
aws cloudformation create-stack --stack-name ClassiqBraketRole --template-body file://AssumeRole.cf.yaml --capabilities CAPABILITY_NAMED_IAM --parameters ParameterKey=TrustedAccount,ParameterValue=${CORRECT_TRUSTED_ACCOUNT} ParameterKey=ExternalId,ParameterValue=${CORRECT_EXTERNAL_ID_VALUE}
Warning
The required parameters may differ between users. Contacting Classiq support is required!
In order to learn more about IAM roles, visit AWS documentation
Required Credentials¶
When executing via the Classiq platform using AWS Cloud, there are several required credentials:
aws_role_arn
- Make sure the initial setup step is completed.
- Go to the AWS Identity and Access Management (IAM) service.
- Under
Roles
, search for theCrossAccountRoleForBraket
role. - Copy this role's
ARN
and use it as theaws_role_arn
.
s3_bucket_name
- Create a new bucket. It's name must start with
amazon-braket-
. - Use the bucket's name as the
s3_bucket_name
. This is the bucket that will save the execution results.
- Create a new bucket. It's name must start with
s3_folder
- Enter the path to the folder within the
S3 bucket
. This is the path within the bucket where the execution results will be saved.
- Enter the path to the folder within the
For further support, contact Classiq support.
Supported Backends¶
The Classiq executor supports any available gate-based Amazon Braket simulator and quantum hardware.
Included hardware:
- "IonQ device"
- "Lucy"
- "Aspen-11"
- "Aspen-M-1"
Included simulators:
- "SV1"
- "TN1"
- "dm1"