Quickly get an ArangoDB instance running on an Amazon EC2 Linux Instance
Update existing package list and then install prerequieites.
sudo yum update -y
If your running a regular amazon linuz instance
sudo yum install docker
Otherwise amazon linux 2 instances require installing docker from Amazon's Linux extra packages
sudo amazon-linux-extras install docker
Start the docker service
sudo service docker start
REgister the ec2-user
to the docker group so we don't need to run sudo
with commands
sudo usermod -a -G docker ec2-user
You'll need to logout and log back in for this change to take effect. The simplest way is to close the SSH connection and reconnect. Now you can run docker info
and it should return docker information.
First we need to pull the ArangoDB Docker image, simply run;
docker pull arangodb
Now we can start an ArangoDB instance; The ARANGO_RANDOM_ROOT_PASSWORD will generate a random root password upon startup and print to the console and to docker logs. Alternatively you can use ARANGO_NO_AUTH=1 to disabled authentication or set your own password with ARANGO_ROOT_PASSWORD=somepassword.
Note: this way of specifying logins only applies to single server installations. With clusters you have to provision the users via the root user with empty password once the system is up.
docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 -d --name arangodb-instance arangodb
We can now call on our container with the arangodb-instance
name. Let's request the IP address Arango is listening on;
docker inspect --format '{{ .NetworkSettings.IPAddress }}' arangodb-instance
If you want to allow outisde access to ArangoDB, you'll need to expose port 8529
; We will control access to this later with Aamazon security groups and virtual private networks.
docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 -p 8529:8529 -d arangodb
We need to link the container inorder to use the running instance from an application;
docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 --name my-app --link arangodb-instance:db-link arangodb
A list of commands is available with the following command;
docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 arangodb arangod --help
We're now going to start our instance with no authentication and map the ArangoDB port to our Instance port, exposing it;
docker run -e ARANGO_NO_AUTH=1 -p 8529:8529 -td arangodb --restart unless-stopped
The -d
flag detaches the container and runs the process in the background, printing the container id.
-t
allocates a pseudo-TTY
We're using the
--restart unless-stopped
flag to tell Docker to restart our instance automatically unless told otherwise withdocker stop