# DRAGEN on AWS

You can run DRAGEN analysis on Amazon Web Services (AWS). For information on using DRAGEN, see the [DRAGEN User Guide Section](https://help.dragen.illumina.com/product-guides/dragen-v4.5). For information on using AWS, see the AMI documentation available on the Amazon Web Services site.

## Getting Access to the DRAGEN AMI (Amazon Machine Image)

There are two options available for using the AMI: a Marketplace AMI (Pay-As-You-Go) and a Private AMI (Bring-Your-Own-License). To use the Marketplace AMI, visit the AWS Marketplace and subscribe to the DRAGEN Complete Suite. For access to the Private AMI, please contact our [sales team](https://www.illumina.com/company/contact-us.html) to obtain licensing and deployment instructions. Also, please refer to the [Cloud Licensing Reference Section](https://help.dragen.illumina.com/reference/licensing/cloud_licensing) for more information.

## Launch an Instance

To launch an EC2 instance, refer to the [AWS EC2 Launch Guide documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/LaunchingAndUsingInstances.html) - making sure you select the desired DRAGEN AMI and instance type.

* For instance type, an [EC2 FPGA-powered instance](https://aws.amazon.com/ec2/instance-types/f2/) is required. f2.6xlarge instance type is recommended for DRAGEN if regionally available, otherwise f1.4xlarge.
* For configure storage, we recommend attaching 2TB of EBS storage using 4x 500GB GP3 volumes configured as RAID0, if local instance storage is insufficient

## Connect to and Configure Your Instance

1. Navigate to the Instances page and select the instance to connect to.
2. Click **Connect**, then choose **SSH client**.
3. instanceUse appropriate username: ec2-user for EL8 images, or centos for EL7 images.
4. Mount the disks to `/staging` on the instance using the following commands as needed.

```
sudo yum -y install mdadm
sudo mdadm --create --verbose /dev/md0 --level=0 --name=MY_RAID0 --raid-devices=<number of volumes> <device name 1> <device name 2>
sudo mkfs.ext4 -L MY_RAID0 /dev/md0
sudo mkdir -p /staging
sudo sh -c "echo 'LABEL=MY_RAID0 /staging ext4 defaults,noatime 0 0' >> /etc/fstab"
sudo mount -a
```

For example, the following command mounts four volumes attached at `/dev/nvme1n1`, `/dev/nvme2n1`, `/dev/nvme3n1`, and `/dev/nvme4n1` to a RAID 0 on `/staging`.

```
sudo yum -y install mdadm
sudo mdadm --create --verbose /dev/md0 --level=0 --name=MY_RAID0 --raid-devices=4 /dev/nvme1n1 /dev/nvme2n1 /dev/nvme3n1 /dev/nvme4n1
sudo mkfs.ext4 -L MY_RAID0 /dev/md0
sudo mkdir -p /staging
sudo sh -c "echo 'LABEL=MY_RAID0 /staging ext4 defaults,noatime 0 0' >> /etc/fstab"
sudo mount -a
```

## Data Flow

Input files, including the [hash table](https://support.illumina.com/sequencing/sequencing_software/dragen-bio-it-platform/product_files.html), must be downloaded to the instance. DRAGEN can also process large input files (e.g., FASTQ, BAM) directly from s3 or a pre-signed URL. Ensure the instance has access to the s3 bucket via local credentials or an IAM role.

## Simple Run Example

```
cd /ephemeral/
wget https://webdata.illumina.com/downloads/software/dragen/resource-files/hg38-alt_masked.cnv.graph.hla.rna-10-r4.0-1.tar.gz
mkdir /ephemeral/hg38-alt_masked.cnv.graph.hla.rna-10-r4.0-1
tar xvfz hg38-alt_masked.cnv.graph.hla.rna-10-r4.0-1.tar.gz -C hg38-alt_masked.cnv.graph.hla.rna-10-r4.0-1
wget https://ilmn-dragen-giab-samples.s3.amazonaws.com/WES/HG002/NA24385-AJ-Son-R1-NS_S33_L001_R2_001.fastq.gz 
wget https://ilmn-dragen-giab-samples.s3.amazonaws.com/WES/HG002/NA24385-AJ-Son-R1-NS_S33_L001_R1_001.fastq.gz

dragen \
-r /ephemeral/hg38-alt_masked.cnv.graph.hla.rna-10-r4.0-1 \
--fastq-file1 /ephemeral/NA24385-AJ-Son-R1-NS_S33_L001_R2_001.fastq.gz \
--fastq-file2  /ephemeral/NA24385-AJ-Son-R1-NS_S33_L001_R2_001.fastq.gz \
--RGID NA24385_RGID \
--RGSM NA24385 \
--enable-map-align true \
--enable-map-align-output true \
--enable-duplicate-marking true \
--enable-variant-caller true \
--intermediate-results-dir /ephemeral/ \
--output-file-prefix NA24385 \
--output-directory /ephemeral/ 
--lic-server <LICENSE> # needed for private AMI users
```

You can use DRAGEN command-line options. For more information on DRAGEN analysis and command line options, see the [Command Line Options Section](https://help.dragen.illumina.com/product-guides/dragen-v4.5/command-line-options) of the user guide. For information on using AWS, see the AMI documentation available on the Amazon Web Services site.

Note: As stated in the [Cloud Licensing Reference Section](https://help.dragen.illumina.com/reference/licensing/cloud_licensing), if running DRAGEN in a container with IDMSv2 - make sure to increase your hop count to at least 2.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.dragen.illumina.com/reference/dragen-multi-cloud/dragen-on-aws.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
