Skip to content

Deployment onto an AWS Instance

C. Masato Nakano edited this page May 18, 2018 · 1 revision

Deploying Redis onto Amazon AWS Instance (Test Phase):

Any user who is signed up for AWS can immediately launch an EC2 (elastic compute cloud) instance. Here, we test a trial run of deploying Redis onto an EC2 instance due to ease of set-up, use, and lack of cost with AWS.

Creating a Key Pair:

AWS uses public-key cryptography to secure the login information for your instance. A Linux instance has no password; you use a key pair to log in to your instance securely. You specify the name of the key pair when you launch your instance, then provide the private key when you log in using SSH.

Key pairs are specific to regions. For this test deployment, we create a key pair for an instance in the US West (N. California). Creating a key pair will start a download of a private key file of format:

_key-pair-name_.pem

whose contents are the private key.

Using a shell client, we can set permissions of the key pair file so that only we can read it

chmod 400 _key-pair-name_.pem

Unfortunately, for this test deployment, we create a key pair name not according to the Amazon-recommended format (spec_name-key-pair-region_name). Nonetheless, it appears as this is solely a stylistic problem.

Connecting to the instance through a secure shell client involves:

ssh -i _key-pair-name_.pem _public-dns-ipv4_

For this initial test deployment, our Public DNS is:

ec2-52-53-213-173.us-west-1.compute.amazonaws.com

Installing Redis:

Redis is installed according to the specifications in the Redis Overview page.

Specific notes with regards to AWS EC2:

  • Installing Redis requires installation of gcc and tcl
  • update-rc.d as recommended by the Redis quickstart doc is not present in EC2, chkconfig must be used instead

It is a good idea to test that Redis makes and builds correctly in the instance before moving on.

Once verified and sound, we can continue working on a more permanent installation of Redis on a server.

Specific steps (As of yet unorganized properly):

Create directories to store Redis configuration and data files in: /etc/redis /var/redis

Copy init script from Redis download into init.d, rename according to port (6379 in this case)

Copy configuration file to /etc/redis

Edit config file:

  • daemonize should be set to yes
  • pidfile should be set to /var/run/redis_PORT#.pid
  • port should be set to PORT#
  • loglevel as per discretion
  • logfile should be set to /var/log/redis_PORT#.log
  • dir should be set to /var/redis/PORT#

Create directory to work as data and working directory for Redis instance:

/var/redis/PORT#

Add Redis init script to default runlevel by using:

sudo chkconfig --levels 3 redis_PORT#

Start Redis server by:

sudo /etc/init.d/redis_PORT# start

Check to see if the Redis server is up by:

redis-cli ping

Proper response should be PONG.

Clone this wiki locally