Run CrateDB on Amazon Web Services (AWS)

Amazon Web Services (AWS) is the worlds most popular cloud hosting provider with 1000s of options for platforms, applications and infrastructure.

An AMI (Amazon Machine Image) is a pre-configured virtual appliance optimized for a particular use. With the CrateDB AMI, this includes dependencies, optimization and configuration to get CrateDB running as quickly and efficiently as possible. Using the AMI is our recommended method for running CrateDB clusters on AWS.

With the AWS Command Line Interface

You can find the CrateDB AMI via the command line interface, in the format crate-<VERSION>-<REV>-<BASE_AMI>.

For example, to find all CrateDB AMIs available:

aws ec2 describe-images --filters "Name=name,Values=crate-*"
Terminal Output

If you are looking for particular CrateDB version, you can be more precise:

aws ec2 describe-images --filters "Name=name,Values=crate-0.51.1-1-amzn-*"

To run instances based on your AMI of choice, run the following command with the image-id of the CrateDB version you wish to run, the name of a security group that allows the ports CrateDB requires (4200, 4300) and if you want to use the EC2 API for inter-node discovery, a link to a user-data script.

aws ec2 run-instances --image-id ami-96702de1 --count x --instance-type m3.medium --user-data $(base64 user-data.sh) --key-name keyname --security-groups groupname

With the AWS Web Interface

To use the AWS website to launch an instance, click the blue ‘Launch Instance’ button and find the available CrateDB AMIs under the Community AMIs section.

AWS GUI

Click the ‘select’ button on the AMI you wish to use and set the instance configuration. The most important options here are the number of instances you require and selecting a security group that opens ports 4200 and 4300.

The User Data File

Amongst other configuration options, the User Data file is primarily used for setting your AWS credentials to make use of the EC2 API for inter-node discovery.

For example:

#!/bin/bash
echo "
export AWS_ACCESS_KEY_ID=''
export AWS_SECRET_ACCESS_KEY=''
" >> /etc/sysconfig/crate

More Details

For more options and details on setting up a CrateDB cluster on AWS with our AMI, read our best practice guide. For more details on running CrateDB with Docker on AWS, read our blog post.

Next Steps