

# Configure your hybrid job instance
<a name="braket-jobs-configure-job-instance-for-script"></a>

Depending on your algorithm, you may have different requirements. By default, Amazon Braket runs your algorithm script on an `ml.m5.large` instance. However, you can customize this instance type when you create a hybrid job using the following import and configuration argument.

```
from braket.jobs.config import InstanceConfig

job = AwsQuantumJob.create(
    ...
    instance_config=InstanceConfig(instanceType="ml.g4dn.xlarge"), # Use NVIDIA T4 instance with 4 GPUs.
    ...
    ),
```

If you are running an embedded simulation and have specified a local device in the device configuration, you can additionally request more than one instance in the `InstanceConfig` by specifying the `instanceCount` and setting it to be greater than one. The upper limit is 5. For instance, you can choose 3 instances as follows.

```
from braket.jobs.config import InstanceConfig
job = AwsQuantumJob.create(
    ...
    instance_config=InstanceConfig(instanceType="ml.g4dn.xlarge", instanceCount=3), # Use 3 NVIDIA T4 instances
    ...
    ),
```

When you use multiple instances, consider distributing your hybrid job using the data parallel feature. See the following example notebook for more details on how-to see this [Parallelize training for QML](https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/hybrid_jobs/5_Parallelize_training_for_QML/Parallelize_training_for_QML.ipynb) example.

The following three tables list the available instance types and specs for standard, high performance, and GPU accelerated instances.

**Note**  
To view the default classical compute instance quotas for Hybrid Jobs, see the [Amazon Braket Quotas](braket-quotas.md) page.


| Standard Instances | vCPU | Memory (GiB) | 
| --- | --- | --- | 
| ml.t3.large | 2 | 8 | 
| ml.t3.xlarge | 4 | 16 | 
| ml.t3.2xlarge | 8 | 32 | 
| ml.m5.large (default) | 4 | 16 | 
| ml.m5.xlarge | 4 | 16 | 
| ml.m5.2xlarge | 8 | 32 | 
| ml.m5.4xlarge | 16 | 64 | 
| ml.m5.12xlarge | 48 | 192 | 
| ml.m5.24xlarge | 96 | 384 | 


| High performance Instances | vCPU | Memory (GiB) | 
| --- | --- | --- | 
| ml.c5.xlarge | 4 | 8 | 
| ml.c5.2xlarge | 8 | 16 | 
| ml.c5.4xlarge | 16 | 32 | 
| ml.c5.9xlarge | 36 | 72 | 
| ml.c5.18xlarge | 72 | 144 | 
| ml.c5n.xlarge | 4 | 10.5 | 
| ml.c5n.2xlarge | 8 | 21 | 
| ml.c5n.4xlarge | 16 | 32 | 
| ml.c5n.9xlarge | 36 | 72 | 
| ml.c5n.18xlarge | 72 | 192 | 


| GPU accelerated Instances | GPUs | vCPU | Memory (GiB) | GPU Memory (GiB) | 
| --- | --- | --- | --- | --- | 
| ml.p4d.24xlarge | 8 | 96 | 1152 | 320 | 
| ml.g4dn.xlarge | 1 | 4 | 16 | 16 | 
| ml.g4dn.2xlarge | 1 | 8 | 32 | 16 | 
| ml.g4dn.4xlarge | 1 | 16 | 64 | 16 | 
| ml.g4dn.8xlarge | 1 | 32 | 128 | 16 | 
| ml.g4dn.12xlarge | 4 | 48 | 192 | 64 | 
| ml.g4dn.16xlarge | 1 | 64 | 256 | 16 | 
| ml.g6.xlarge | 1 | 4 | 16 | 24 | 
| ml.g6.2xlarge | 1 | 8 | 32 | 24 | 
| ml.g6.4xlarge | 1 | 16 | 64 | 24 | 
| ml.g6.8xlarge | 1 | 32 | 128 | 24 | 
| ml.g6.12xlarge | 4 | 48 | 192 | 96 | 
| ml.g6.16xlarge | 1 | 64 | 256 | 24 | 
| ml.g6.24xlarge | 4 | 96 | 384 | 96 | 
| ml.g6.48xlarge | 8 | 192 | 768 | 192 | 
| ml.g6e.xlarge | 1 | 4 | 32 | 48 | 
| ml.g6e.2xlarge | 1 | 8 | 64 | 48 | 
| ml.g6e.4xlarge | 1 | 16 | 128 | 48 | 
| ml.g6e.8xlarge | 1 | 32 | 256 | 48 | 
| ml.g6e.12xlarge | 4 | 48 | 384 | 192 | 
| ml.g6e.16xlarge | 1 | 64 | 512 | 48 | 
| ml.g6e.24xlarge | 4 | 96 | 768 | 192 | 
| ml.g6e.48xlarge | 8 | 192 | 1536 | 384 | 

Each instance uses a default configuration of data storage (SSD) of 30 GB. But you can adjust the storage in the same way that you configure the `instanceType`. The following example shows how to increase the total storage to 50 GB.

```
from braket.jobs.config import InstanceConfig

job = AwsQuantumJob.create(
    ...
    instance_config=InstanceConfig(
        instanceType="ml.g4dn.xlarge",
        volumeSizeInGb=50,
    ),
    ...
    ),
```

## Configure the default bucket in `AwsSession`
<a name="braket-jobs-configure-default-bucket"></a>

Utilizing your own `AwsSession` instance provides you with enhanced flexibility, such as the ability to specify a custom location for your default Amazon S3 bucket. By default, an `AwsSession` has a pre-configured Amazon S3 bucket location of `"amazon-braket-{id}-{region}"`. However, you have the option to override the default Amazon S3 bucket location when creating an `AwsSession`. Users can optionally pass in an `AwsSession` object into the `AwsQuantumJob.create()` method, by providing the `aws_session` parameter as demonstrated in the following code example.

```
aws_session = AwsSession(default_bucket="amazon-braket-s3-demo-bucket")

# Then you can use that AwsSession when creating a hybrid job
job = AwsQuantumJob.create(
    ...
    aws_session=aws_session
)
```