How to Install MinIO in Distributed Mode on AWS EC2
AWS has a majority of the more than one million public cloud deployments of MinIO. This is one of the reasons that we built a managed application in AWS Marketplace, which can be deployed with only a handful of clicks.
Running MinIO as a managed app not only provides streamlined deployment, it also offloads operations through automations and transparent integrations with additional AWS components. It’s a quick, easy way to get started developing applications backed by MinIO.
As developers, we also know that developers like the flexibility to do things your own way. In true MinIO spirit, we want you to be able to customize to your heart’s content, so we’re making sure that you have everything you need to make that happen.
If you’d like to learn how to quickly and easily deploy MinIO on AWS to your specifications, read on.
This is a guide on how to deploy MinIO on AWS EC2. In this guide we set up a 16 TiB Instance using EBS volumes.
- Create 4 AWS Instances at https://aws.amazon.com/console/
- Start by logging into your account: “Sign In to the Console”
- Provide your Account ID, IAM user name, and password
- Click “Sign in”
- Once you are logged in go to the “EC2” link
- And Launch instances by clicking “Launch instances”
7. Choose the Amazon Machine Image also known as AMI. In this case we are going to be using Amazon Linux AMI from the top with x86 architecture.
8. Then, select the Instance Type you want to test or use. Keep in mind that they can get very expensive as you increase HW capacity. You can use the AWS Calculator to estimate the price you will pay based on the time it will be used. For this example, we are going to use the c6i.metal Instance Type.
9. Then click in “Next: Configure Instance Details” so that you can select the number of machines you want to use for MinIO. Then select 4 of them.
10. Once you’ve selected 4, click on “Next: Add Storage” and add 4 extra volumes to run MinIO in distributed mode. There are a few things to keep in mind. First of all, notice that because we are using EBS type storage, then it really does not matter which device letter you configure as long as it is mapped consecutively later on. The size is up to you and depends on your needs. Look for the best price-performance ratio and set your configuration. Please remember to delete or remove the disks once an instance is terminated so as not to incur extra cost.
Once this is done, and you are satisfied with it, you can add tags. This depends on your organization and how you plan to use AWS in general. At the very least, it is useful to have some tags to make it easier for you to find and terminate instances:
function get_running_instances_by_tag() { |
11. Next, let’s configure the Security group. This is important for you to connect via SSH and allow access to MinIO for management via port 9000 on TCP.
12. Now you can review and launch the instances, and as a final step, add the key pair so that you can ssh to your host easily using a .pem file.
13. Wait for the instances to be in the running state so that you can connect and configure each host to install MinIO.
14. While you are waiting, you can use AWS CLI for to automate checking state:
printHeader 2 "Check the status of the instances to be running state" |
15. Once your instances are running, you can now proceed to connect via SSH to each host. The first thing we are going to do is change the /etc/hosts file to allow secure communication between the machines:
ssh -i "celis.pem" ec2-user@ec2-3-239-64-1.compute-1.amazonaws.com |
16. And add this portion to the /etc/hosts files of each instance:
172.31.77.115 host1 |
Please note that we are using the private IP address of our instances. You will need to use the IP address of your instances instead.
17. Next, let’s create the directories where we will map our devices. Again, you must do this for each AWS instance:
mkdir /mnt/data1 |
mount /dev/sdb1 /mnt/data1 |
18. We’re in the home stretch now. Download, install and run minio on each node:
wget https://dl.min.io/server/minio/release/linux-amd64/minio |
19. Install MinIO Client (mc) to manage the cluster. Download the application, set it as executable and configure credentials. For a quick set up and verification, we’re running mc on the same instance as MinIO server. You may follow our example or install mc on another instance, or wherever you wish and then remotely access your MinIO instances.
wget https://dl.min.io/client/mc/release/linux-amd64/mc |
20. Set an alias to make it easier for you to log in and manage MinIO via mc.
[root@ip-172-31-77-115 ec2-user]# ./mc alias set myminio http://localhost:9000 minioadmin minioadmin
mc: Configuration written to `/root/.mc/config.json`. Please update your access credentials.
mc: Successfully created `/root/.mc/share`.
mc: Initialized share uploads `/root/.mc/share/uploads.json` file.
mc: Initialized share downloads `/root/.mc/share/downloads.json` file.Added `myminio` successfully.
21. Finally, let’s measure the speed of MinIO with our new feature, SpeedTest. This will run a short, automated series of tests to quickly verify that your deployment is performing as it should.
[root@ip-172-31-77-115 ec2-user]# ./mc admin speedtest myminio |
Deploy MinIO on AWS EC2 Today
Thanks for reading this tutorial. You now have MinIO installed and have verified performance. Now you can use MinIO Console, mc or the API to create buckets and further configure your deployment. If you have any questions, ping us on hello@min.io or join the Slack community.