> For the complete documentation index, see [llms.txt](https://quanta.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://quanta.gitbook.io/documentation/advanced/deploy-your-own-exchange-on-aws.md).

# Deploy your own exchange on AWS

QUANTA blockchain is a powerful QDEX that enables anyone to launch their own white-label exchange and earn money from transactions fees, listing and other fees.  The entire repo is available to you which you can deploy in just 5 mins: <https://github.com/quantadex/react_quantadex>

The frontend is built on react, which can be run completely client side, as a static webpage.  There are several advantages to this.  It requires zero infrastructure (such as nodejs, nginx, etc) to host a dynamic server.  This means you can deploy to S3, and Cloudfront with zero risk of downtime.

All examples are for demo.quantadex.com, replace your domain as necessary.

### S3 Setup

1. Create a new bucket with the canonical name as your domain name, in our case, demo.quantadex.com
2. Enable Static Hosting
3. Enable Bucket Read

```
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowPublicRead",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::demo.quantadex.com/*"
        }
    ]
}
```

4\. Enable all redirects go to the index.html . This configuration is the most important steps as it redirects are URLs to index.html, which is processed by the react router.

![](https://3282115274-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LR5UzIByyCOIOHd5CFf%2F-LgU3niZymJlfifqNeks%2F-LgU6P5DlKxal8hW4D8S%2Fimage.png?alt=media\&token=38862c1f-f63b-4be5-a809-63d2e4ba2ca9)

4\. Deploy&#x20;

You can either upload the entire project manually or run a script like ours to upload.

```
aws s3 sync --acl public-read public s3://demo.quantadex.com/public
aws s3 cp --acl public-read public/index.html  s3://demo.quantadex.com/
aws s3 sync --acl public-read public/favicon s3://demo.quantadex.com/assets/favicon
```

5\. Verify your end point is working.

### Cloudfront

Cloudfront is CDN service that can get your data closer to the your users endpoints.  Also it enables you to use Amazon's free SSL service.

Create a new distribution

![](https://3282115274-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LR5UzIByyCOIOHd5CFf%2F-LgU3niZymJlfifqNeks%2F-LgU7vRbHcPEscnf9D6a%2Fimage.png?alt=media\&token=02e227ab-65e2-4c6d-8fda-be06cd9e24ed)

In Viewer Protocol Policy, redirect your http traffic to https

In distribution settings, enter your alternate domain names, and pick a custom SSL certificate. (assuming you created already)

![](https://3282115274-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LR5UzIByyCOIOHd5CFf%2F-LgU3niZymJlfifqNeks%2F-LgU87buHcr8Q6dxGghB%2Fimage.png?alt=media\&token=2e1a8719-92d4-44f9-b2cc-5e19068c2e9b)

Create custom errors redirect back to React router. Do the same for 404 and 403 errors.

![](https://3282115274-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LR5UzIByyCOIOHd5CFf%2F-LgU3niZymJlfifqNeks%2F-LgU8WcHrbMp3ZM_ZhH3%2Fimage.png?alt=media\&token=d62aedee-47c4-4b44-b4df-f3c909bec165)

When you deploy, remember to invalidate your cache. or add another line to your deployment script.

```
aws cloudfront create-invalidation --distribution-id 	YourDistributionId --paths "/*"
```

### Route53

Create a new A record alias pointing to your cloudfront

![](https://3282115274-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LR5UzIByyCOIOHd5CFf%2F-LgU3niZymJlfifqNeks%2F-LgU9GUb16bpNHSAgDJo%2Fimage.png?alt=media\&token=45537707-75d8-4ef6-802c-680ae7ec2b07)

### That's it!

If you have additional questions, please send to <partnership@quantadex.com> or reach out to us on Telegram.
