Implementing AWS ECS Services with GlusterFS Shared Storage

Pratik Mungekar
Oct 18, 2018 · 1 min read
  • Issues of data integrity (unless using the TCP protocol instead of UDP)
  • Lack of ability to resize disk partitions readily
  • Except for special implementations, such as under NetApp, not always the greatest performance.

Why GlusterFS?

  • GlusterFS is a distributed file system that can scale up to several petabytes and can handle thousands of clients. It clusters together storage building blocks over RDMA or TCP/IP, and aggregates disk and memory resources in order to manage data in a single global namespace.
  • GlusterFS is a user space file system and hence uses FUSE (file system in user space) to hook itself with the virtual file system (VFS) layer. Gluster uses already tried and tested disk file systems like ext3, ext4, xfs, etc, as the underlying file system to store the data.
  • For more information about Glusterfs please refer this link.

So How Do We Deploy?

The below high level arch diagram represents how the whole setup works.

Lets Build!

Create an empty ECS cluster where we will create an EC2 instance explicitly and install ECS agent and register it with this empty ECS cluster.

  • Select EC2 Linux + Networking
  • Give Cluster name, Check Create Empty cluster checkbox and create cluster.
  • Launch EC2 instance using Ubuntu AMI.
  • Goto Launch instance.
  • Select Ubuntu 16.04 from community AMIs ( ami-03221428e6676db69)
  • Launch the instance with required type, security group and key pair.
    Install docker since its required to run ECS agent on node. Use following steps to install docker.
  • Create ECS config file and add below content.
  • Create a docker image using following Command $docker build -t newimage .
  • Create a AWS ECS Repository and push the image into repo. Refer this link AWS ECS Repository
  • Put all application related file in /mnt/glusterfs/app-1 location on ECS host.
  • Create a AWS ECS definition mount host /mnt/glusterfs/app-1 location to /app container location. Open port 80 for communication.
  • Stack testing.
    - Test Glusterfs failover by rebooting primary server and try to access the mount point on client. It should give connection within 2 seconds since we have set the ping value.
    - Also test the Node application from Web for same scenario.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade