While there are many different ways to run Directus on AWS, from single EC2 instances to a full ELB load-balanced configuration, we like the following combination of services:
- Elastic Beanstalk (EB)
- Elastic Load-Balancer (ELB)
- Elastic Compute Cloud (EC2)
- Simple Storage Service (S3)
- Relational Database Service (RDS) (Aurora)
- Route 53
# Elastic Beanstalk
Will run Directus in an autoscaling environment with a load balancer. Makes sure the instances stay alive, and will replace individual instances in case of unexpected crashes.
We recommend setting up a repo in GitHub (or another Git provider) and configuring it using our manual installation flow. This allows you to later hook up the repo to your Elastic Beanstalk instance through CodeDeploy.
See Deploying Node.js applications to Elastic Beanstalk (opens new window) for more information.
Directus' configuration is all set through environment variables. For a full overview of all available environment variables, see Environment Variables
Allows you to automatically deploy updates to your Directus instance or extensions to Elastic Beanstalk.
See Automatically Deploy from GitHub Using AWS CodeDeploy (opens new window) for more information.
# Simple Storage Service (S3)
Ideal place to store files uploaded to Directus. Your bucket doesn't have to be publicly accessible to the web; Directus will stream files from and to the bucket in its /asset endpoint.
See Creating a bucket (opens new window) for more information.
# Relational Database Service (RDS) (Aurora)
While you can technically use any of the SQL based databases offered in AWS, we like to use Aurora. It's auto-scaling and use-based costs have worked out pretty well for us in the past.
While it's not a technical requirement, it's not a bad idea to configure a CloudFront instance in front of your EB environment. This protects you from DDoS attacks and allows you to cache repeated calls to assets in its CDN.
See Using Elastic Beanstalk with Amazon CloudFront (opens new window) for more information.
# Route 53
The last piece of this puzzle is to assign a domain name to your CloudFront instance. You can use Route 53 for this purpose.
See Routing traffic to an Amazon CloudFront web distribution by using your domain name (opens new window) for more information.