Using AWS Mountpoint

Published on 30 July 2023

Overivew

In this post, we will look at AWS Mountpoint, and their use cases.

AWS Mount Points are a new feature that provide functionality that has been missing for some enterprise customers. While some companies are perfectly fine using APIs to move files to and from S3, in a traditional enterprise environment, there has been been a need to make S3 access easier. Third party software could be used previously, but a lot of that functionality can now be provided natively.

In a nutshell, AWS Mountpoint will present S3 objects as files to your Linux OS. They are visible just via the file system. Another key reason to use AWS Mountpoint is that it is covered by AWS support. S3 is particularly useful for storing large amounts of data in a cheap and reliable manner, and this makes it so much easier.

One question I would be wondering, if when to use AWS Mountpoint, and when to use EFS?

If you have a workload that requires massive scalability, and enormous levels of IOPS, then EFS was the obvious choice previously. It allows access from multiple systems (unlike EBS), scales automatically (again, unlike EBS), and has fantastic levels of write performance (perhaps unlike S3).

But as with any solution, you need to consider factors such as costs and performance. When you include these, S3, with AWS Mountpoint becomes a very good candidate for a lot of use cases.

Service Costs Flexibility Availability Performance
S3 Cheap. Storage is going to be around $0.023 per GB. More connectivity options for cloud native services. 99.99%, stored across multiple AZs. Faster when many (millions) connections read intensive connections are required
EFS Expensive. Approximately $0.30 per GB. Fewer connectivity options from cloud native services. 99.99%, stored across multiple AZs. Faster for fewer (hundreds or thousands), or write intensive connections

Note that S3 will also have charges for PUTs and GETs.

So, if you are running a process on a Linux server that is requires very low latency read/writes to storage, EFS is probably the best match. For a lot of other options though, particularly read intensive, S3 via AWS Mountpoint is going to be the better option.

Installation

AWS Mountpoint can be downloaded and installed as part of your userdata, an example of which in the middle here:

    wget https://s3.amazonaws.com/mountpoint-s3-release/latest/x86_64/mount-s3.rpm
    # Now to isntall it
    sudo yum install ./mount-s3.rpm
    # Mount a folder 
    mkdir ~/mnt
    mount-s3 ghbackupbucket ~/ghbackupbucket

After that, we might want to copy files from our bucket using the AWS Mountpoint functionality. To do that, we mount the bucket, and then we can use OS commands to access the contents. You can see that here:

    # The next line is where we will copy the file from our bucket.
    cp ~/ghbackupbucket/CWConfig_Linux.json /opt/aws/amazon-cloudwatch-agent/etc/
    # sudo aws s3 cp s3://ghbackupbucket/CWConfig_Linux.json /opt/aws/amazon-cloudwatch-agent/etc/

Limitations of AWS Mountpoint

As mentioned, if you are doing a lot of writes where high performance is critical, you probably want an alternative solution such as EFS or even EBS (if access from a single instance is fine). Additionally, if you need to rely on file locking, AWS Mountpoint isn't the solution for you either, so you are again looking at EFS or EBS.

Also, AWS Mountpoint support for Windows is in the works by the sounds of things, but not available at release.

Full userdata using the AWS Mountpoint functionality

We will connect to this bucket from an instance.

AWSMP2

Our full userdata looks like this:

    #!/bin/bash
    yum update -y
    yum install httpd -y
    service httpd start
    chkconfig httpd on
    # This is where we download and install the package
    wget https://s3.amazonaws.com/mountpoint-s3-release/latest/x86_64/mount-s3.rpm
    # Now to isntall it
    sudo yum install ./mount-s3.rpm -y
    # Mount a folder 
    mkdir ~/ghbackupbucket
    mount-s3 ghbackupbucket ~/ghbackupbucket
    echo "<html><h1>My website</h1></html>" > /var/www/html/index.html
    yum install amazon-cloudwatch-agent -y
    sudo mkdir /opt/aws/amazon-cloudwatch-agent/etc -p
    # The next line is where we will copy the file from our bucket.
    cp ~/ghbackupbucket/CWConfig_Linux.json /opt/aws/amazon-cloudwatch-agent/etc/
    # sudo aws s3 cp s3://ghbackupbucket/CWConfig_Linux.json /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json
    cd /opt/aws/amazon-cloudwatch-agent/etc
    sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json

If you then fire up an EC2 instance with the right roles, you can connect to it and see the bucket contents.

AWSMP1

Summary

AWS Mountpoint is great for providing S3 objects as file systems objects. It can do this much cheaper than some of the other options available such as EFS, and it makes a great use for providing easy read access to large amount of stored data, such as data lakes. It can even be used if you have massive farms of servers doing the reads.

Write access works too, but if you have a write-heavy application, consider the other options from AWS too.

comments powered by Disqus