Setting up access to AWS Braket
Prerequisites and Requirements
The following are pre-requisites:
Customer owned AWS Subscription, with Amazon Braket configured as described in the official AWS documentation: https://docs.aws.amazon.com/braket/latest/developerguide/braket-enable-overview.html;
IAM user for programmatic access;
AWS CLI installed as described in the official AWS documentation;
Existing installation of Kvantify Qrunch license and Python wheel;
Client computer with at least 1 GB of free disk space. Minimum 16 GB of RAM, preferably 32 GB or more. MacOS and Linux is natively supported. Windows is only supported through WSL 2;
As all of the AWS services used are fully managed, there are no specific licensing cost involved. The cost incurred is based on the amount of usage of the services;
For monitoring the health of the solution as provided by Amazon Braket, the user can navigate to CloudWatch to check on various logs and performance of the solution. Note that Kvantify Qrunch only integrates with Braket, not directly with CloudWatch.
General Notes:
Please refrain from using ROOT USER of your AWS account for any deployment or operations;
Customers deploying this solution should follow the policy of least privileges for any IAM Users or Roles;
IAM Roles and Assignment Created at Deployment Time
The solution relies solely on fully managed AWS resources that require no instantiation, so there is nothing to deploy on AWS nor is any deployment role necessary. The user communicates with the fully managed AWS services via their IAM user, which needs the AWS managed permissions policy “AmazonBraketFullAccess” plus the custom IAM permission policy found below:
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":[
"ecr:DescribeRepositories",
"ecr:CreateRepository",
"ecr:InitiateLayerUpload",
"ecr:UploadLayerPart",
"ecr:CompleteLayerUpload",
"ecr:BatchCheckLayerAvailability",
"ecr:PutImage"
],
"Resource":"*"
}
]
}
Kvantify Qrunch uses the configuration of the AWS CLI when communicating with AWS.
The AWS CLI is setup on the customer’s local machine and configured to use an IAM user with programmatic access, by following the standard AWS provided CLI documentation. The IAM user needs to have the Amazon managed permissions policy defined above.
As Kvantify Qrunch does not deploy any resources it is available in any region where Amazon Braket is supported. At the time of writing those regions are: us-east-1, us-west-1, us-west-2, eu-west-2, eu-north-1. Specific QPU’s are typically only available in a subset of these regions and the latest list can be found in the Amazon Braket documentation.
Architecture
The Architecture of the solution is illustrated above. Kvantify Qrunch resides on a customer provided client device as a Python wheel, which communicates with Amazon Braket and its dependent service Amazon Cloudwatch. Kvantify Qrunch never creates or requires the user to create any resources on AWS - it communicates exclusively with the fully managed Amazon Braket service and has all auth handled via Amazon IAM. Customers may choose to use the “hybrid jobs” feature of Amazon Braket, in which case Amazon S3, EC2 and ECR also come to use. This optional use case is an execution feature of Amazon Braket, that has no influence on Kvantify Qrunch. It is fully provided by Amazon Braket and described in its own documentation: https://docs.aws.amazon.com/braket/latest/developerguide/braket-jobs.html
Cost Estimation
Kvantify Qrunch includes a cost estimation framework, which calculates the cost of running a given job on Braket. This is done by first performing a local simulation run, which registers the number of tasks and jobs involved and estimates a price. The framework is integrated with the AWS price API, so cost estimates are always based on the latest Braket prices for shots and tasks. Indicative prices for small educational molecular calculations are in the 100$ range, e.g. the examples of the bundled /demos folder. The large showcases of the Kvantify use case catalog and corresponding tutorials, typically cost in the order of 1000$.
Testing the Solution
Install Kvantify Qrunch and configure AWS CLI as described above;
Validate AWS CLI configuration with the following command line: aws braket get-device –device-arn arn:aws:braket:::device/quantum-simulator/amazon/sv1 –region us-east-1;
After the AWS CLI is correctly configured, Kvantify Qrunch can be smoke tested against Braket by running the aws_configuration_test.py script, provided in the .data/scripts folder of the Kvantify Qrunch wheel. This process is described in full detail in the Kvantify Qrunch documentation;
This demonstrates that Kvantify Qrunch can communicate with AWS Braket and that it has permissions to execute a tiny test job on a Braket SV1 simulator.