AccessDeniedException in Amazon Braket
Amazon Braket Learning Course
I have created a learning course on Amazon Braket, AWS’s quantum computing service.
This course is designed for those with no prior knowledge of quantum computing or AWS, and by the end, you’ll even be able to learn about quantum machine learning. Take advantage of this opportunity to build your skills in quantum technologies!
AccessDeniedException in Amazon Braket
When attempting to run the SV1, TN1, DM1 simulators or quantum computers on Amazon Braket, the following error may be encountered.
---------------------------------------------------------------------------
AccessDeniedException Traceback (most recent call last)
Cell In[12], line 6
3 ghz = ghz_circuit(n_qubits)
5 # run GHZ circuit on SV1
----> 6 result = device.run(ghz, shots=1000).result()
7 counts = result.measurement_counts
8 print(counts)
File ~/anaconda3/envs/Braket/lib/python3.10/site-packages/braket/aws/aws_device.py:207, in AwsDevice.run(self, task_specification, s3_destination_folder, shots, poll_timeout_seconds, poll_interval_seconds, inputs, gate_definitions, reservation_arn, *aws_quantum_task_args, **aws_quantum_task_kwargs)
205 if self._noise_model:
206 task_specification = self._apply_noise_model_to_circuit(task_specification)
--> 207 return AwsQuantumTask.create(
208 self._aws_session,
209 self._arn,
210 task_specification,
211 s3_destination_folder
212 or (
213 AwsSession.parse_s3_uri(os.environ.get("AMZN_BRAKET_TASK_RESULTS_S3_URI"))
214 if "AMZN_BRAKET_TASK_RESULTS_S3_URI" in os.environ
215 else None
216 )
217 or (self._aws_session.default_bucket(), "tasks"),
218 shots if shots is not None else self._default_shots,
219 poll_timeout_seconds=poll_timeout_seconds,
220 poll_interval_seconds=poll_interval_seconds or self._poll_interval_seconds,
221 inputs=inputs,
222 gate_definitions=gate_definitions,
223 reservation_arn=reservation_arn,
224 *aws_quantum_task_args,
225 **aws_quantum_task_kwargs,
226 )
File ~/anaconda3/envs/Braket/lib/python3.10/site-packages/braket/aws/aws_quantum_task.py:212, in AwsQuantumTask.create(aws_session, device_arn, task_specification, s3_destination_folder, shots, device_parameters, disable_qubit_rewiring, tags, inputs, gate_definitions, quiet, reservation_arn, *args, **kwargs)
207 if unbounded_parameters := param_names - set(inputs.keys()):
208 raise ValueError(
209 f"Cannot execute circuit with unbound parameters: {unbounded_parameters}"
210 )
--> 212 return _create_internal(
213 task_specification,
214 aws_session,
215 create_task_kwargs,
216 device_arn,
217 device_parameters or {},
218 disable_qubit_rewiring,
219 inputs,
220 gate_definitions=gate_definitions,
221 quiet=quiet,
222 *args,
223 **kwargs,
224 )
File ~/anaconda3/envs/Braket/lib/python3.10/functools.py:889, in singledispatch.<locals>.wrapper(*args, **kw)
885 if not args:
886 raise TypeError(f'{funcname} requires at least '
887 '1 positional argument')
--> 889 return dispatch(args[0].__class__)(*args, **kw)
File ~/anaconda3/envs/Braket/lib/python3.10/site-packages/braket/aws/aws_quantum_task.py:727, in _(circuit, aws_session, create_task_kwargs, device_arn, device_parameters, disable_qubit_rewiring, inputs, gate_definitions, *args, **kwargs)
718 openqasm_program = OpenQASMProgram(
719 source=openqasm_program.source,
720 inputs=inputs_copy,
721 )
723 create_task_kwargs |= {
724 "action": openqasm_program.json(),
725 "deviceParameters": final_device_parameters.json(exclude_none=True),
726 }
--> 727 task_arn = aws_session.create_quantum_task(**create_task_kwargs)
728 return AwsQuantumTask(task_arn, aws_session, *args, **kwargs)
File ~/anaconda3/envs/Braket/lib/python3.10/site-packages/braket/aws/aws_session.py:273, in AwsSession.create_quantum_task(self, **boto3_kwargs)
271 if job_token:
272 boto3_kwargs["jobToken"] = job_token
--> 273 response = self.braket_client.create_quantum_task(**boto3_kwargs)
274 broadcast_event(
275 _TaskCreationEvent(
276 arn=response["quantumTaskArn"],
(...)
280 )
281 )
282 return response["quantumTaskArn"]
File ~/anaconda3/envs/Braket/lib/python3.10/site-packages/botocore/client.py:570, in ClientCreator._create_api_method.<locals>._api_call(self, *args, **kwargs)
566 raise TypeError(
567 f"{py_operation_name}() only accepts keyword arguments."
568 )
569 # The "self" in this scope is referring to the BaseClient.
--> 570 return self._make_api_call(operation_name, kwargs)
File ~/anaconda3/envs/Braket/lib/python3.10/site-packages/botocore/context.py:123, in with_current_context.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
121 if hook:
122 hook()
--> 123 return func(*args, **kwargs)
File ~/anaconda3/envs/Braket/lib/python3.10/site-packages/botocore/client.py:1031, in BaseClient._make_api_call(self, operation_name, api_params)
1027 error_code = error_info.get("QueryErrorCode") or error_info.get(
1028 "Code"
1029 )
1030 error_class = self.exceptions.from_code(error_code)
-> 1031 raise error_class(parsed_response, operation_name)
1032 else:
1033 return parsed_response
AccessDeniedException: An error occurred (AccessDeniedException) when calling the CreateQuantumTask operation: AWSServiceRoleForAmazonBraket role doesn't exist. Please visit https://console.aws.amazon.com/braket/home?#/permissions?tab=executionRoles to create AWSServiceRoleForAmazonBraket role.
Amazon Braket managed simulators and quantum computers automatically integrate with other AWS services, such as saving results to S3 after execution. If the necessary permissions for Amazon Braket to interact with these services are not set, an error will be displayed.
To create these permissions, go to the Amazon Braket toppage, open the “Permissions and settings” menu, click on “Execution roles”, and then click the section highlighted in red as shown below. This will enable the Amazon Braket managed simulators to run properly.

Amazon Braket Learning Course
I have created a learning course on Amazon Braket, AWS’s quantum computing service.
This course is designed for those with no prior knowledge of quantum computing or AWS, and by the end, you’ll even be able to learn about quantum machine learning. Take advantage of this opportunity to build your skills in quantum technologies!