


Allowing 20GiB of disk space for an r4.large should be plenty. Under Size (GiB) make sure to allocate enough disk space for the instance so that it can safely store the entire Redis database on disk and have space for logs, etc. For IAM Role, select the newly created role from the dropdown and then select Next: Add Storage. Select your instance type and click Configure Instance Details. From the Quick Start Menu, select the Ubuntu Server 16.04 LTS (HVM) option. Go again to the EC2 UI and select Launch Instance. Create your group with the settings below. We’ll also need to allow an SSH connection to allow us to get onto the instance. To recreate that rule, we’ll need to add an inbound rule from your VPC’s private IPs. ElastiCache instances by default are only accessible from resources within your VPC. Now, go to the security groups UI ( EC2 -> Security Groups) and start to create a new group. Now you have a role (and the UI automatically handles creating an instance policy for that role) that you can give your Redis instance. Then proceed to the next step, give your role a name, and then click Create. Back in the Create Role interface, you should be able the refresh the dropdown by clicking the spinning arrows button and then find and select your policy by name. Proceed to the next step, give the policy a descriptive name, and then create it. This statement allows any service with this role to view and modify content within the bucket. Make sure to replace the placeholder with the newly created bucket’s name.

Select the JSON tab to input the policy definition directly. Then, under Attach permissions policies, select Create policy. First, select EC2 for the service that will use this role. Now go to IAM section, click Roles, then Create role. You can optionally choose more custom options like deleting objects older than X days or storing all objects using less frequent access for cost saving. Make sure the bucket is private (that should be the default). Follow the instructions in the README and Terraform will deploy the necessary dependencies and you can skip ahead to configure the instance Via AWS Console UIįirst, go to the S3 section and create a new bucket. We’ve written the following steps as a terraform script. Terraform is a tool that lets you describe and deploy infrastructure as code. One option is to use Terraform to automate the creation of these dependencies.

#Install redis on ec2 how to#
Learning how to use IAM roles, security groups, EC2, S3, etc can be daunting, and it could be worth the premium to offload the concern to a managed service. The cognitive load of maintaining infrastructure is meaningful. Experiment and prototype with a managed Redis to be sure it’s worth the investment to learn and host it yourself. Reasons to stay with ElastiCache Uncertain NeedsĮlastiCache is a great choice if you’re not sure you’ll need Redis in the long-term.
#Install redis on ec2 install#
ElastiCache restricts the ability to install any version of Redis, easily set up backups on a custom schedule, and use any instance type available in EC2 (including some that are cheaper per GB of memory). More FlexibilityĬonfiguring an instance for Redis allows an unmatched level of custom control. These savings could be up to thousands of dollars per month depending on the size of your Redis cluster. Running Redis on EC2 can also be done on spot instances, enabling an additional saving of ~70% (assuming the use case permits using a spot instance). Running an on-demand r4.large on EC2 and setting up Redis is 50% cheaper than using an cache.r4.large.
