Getting Started with Fli: Using AWS CloudFormation

FlockerHub and Fli logo

    Take advantage of your 5 free GB while it lasts!

    This is the second post in a series that is aimed at getting you off the ground and using Fli and FlockerHub.

    Use AWS CloudFormation

    This blog post will walk you through using a CloudFormation template that we have provided to help you easily get started using Fli on AWS. We will take 10-15 minutes to download the template, create our CloudFormation in AWS Console, log in to our newly created Fli client and start using Fli.

    Prerequisites

    Video Walkthrough

    If you would like to view the video, see below.

    Step-by-Step Tutorial

    Overall, you will take the following steps to complete this tutorial:

    • Go to the Amazon CloudFormation Console.
    • Click Create Stack
    • Choose “Upload a template”, and then choose the fli-CloudFormation-Ubuntu16.04 template from this repository.
    • Click Next
    • Choose your SSH Key and give your Stack a name.
    • Click Create to start the Stack.

    Download the Pre-Baked CloudFormation Template

    git clone https://github.com/ClusterHQ/examples
    cd example/fli-cloudformation
    ls fli-cloudformation/
    README.md                       fli-CloudFormation-Ubuntu16.04

    Log In to AWS CloudFormation

    CF Dash

    Next, click Create Stack in the top left.

    Set Up the Template and Deploy Your Stack

    Choose the template from the examples repository.

    Choose CF Tempalte

    You will use the Upload a template to Amazon S3.

    Before Next CF Dash

    Click Next, then enter a Stack name and an SSH Key.

    Add CF Temp Info

    Then click Next, Next, Create and wait for your Fli client to boot up.

    SSH to Your New Machine and Start Using Fli!

    Now that your CloudFormation template is complete, you can find the DNS name of your server in the outputs tab of your CloudFormation stack.

    Stack Outputs

    ssh -i ~/yourkey.pem ubunutu@<DNS-NAME-FROM-CLOUDFORMATION-OUTPUT>
    sudo su
    fli setup --zpool chq 
    fli init MyFirstVolumeset -a owner=me,env=vagrant -d "My first volumeset for snapshots!"
    fli create MyFirstVolumeset my-first-volume -a first_volume=true
    fli snapshot MyFirstVolumeset:my-first-volume MySnapshot

    Sync and Push Your New Volumeset and Snapshot!

    First, you need a token.

    In order to receive a token, sign up for FlockerHub and visit the token creation settings page to create your new token.

    Copy the contents of the authentication token file token.txt to a file in your new machine.

    The authentication token can be created by navigating to your settings in FlockerHub. Also, make sure to place it in /root/ because Fli is set up in this guide to run as a container with the /root/ directory mapped in as a volume. You can change the alias and volume in .bashrc if you desire.

    $ vi /root/my.token # (type `i` then paste the token, then hit `esc`, then type `:wq!` then hit RETURN)

    Once your token is on the machine, use it to configure Fli.

    $ fli config --token /root/my.token

    Then, you can sync and push your data!

    $ fli sync MyFirstVolumeset
    $ fli push MyFirstVolumeset:MySnapshot

    Visit your volumesets page to see your newly created volumeset.

    First Volumeset

    Where to Go From Here

    More Examples

    Check out our How To Examples for using Fli. There are also videos below for other use cases!

    Notes About the Environment

    This environment above only provisions a 100GB EBS volume to support Fli. The alloted free amount with new FlockerHub accounts is 5GB. If you wish to use more data than this, email support@clusterhq.com

    You can optionally edit the CloudFormation template where the size of the volume is set, in the type AWS::EC2::Volume where it currently is set for "Size" : "100",. You may edit this to be larger or as small at 1GB, which is the minimum AWS allows.

    "EBSVolume": {
          "Type":"AWS::EC2::Volume",
          "Properties" : {
            "AvailabilityZone" : { "Fn::GetAtt" : [ "EC2Instance", "AvailabilityZone" ] },
            "Encrypted" : "true",
            "Size" : "100",
            "Tags" : [ {
               "Key" : "Fli",
               "Value" : "EC2 Node"
             } ]
           },
           "DeletionPolicy" : "Snapshot"
        },
        "MountPoint" : {
          "Type" : "AWS::EC2::VolumeAttachment",
          "Properties" : {
             "InstanceId" : { "Ref" : "EC2Instance" },
             "VolumeId"  : { "Ref" : "EBSVolume" },
             "Device" : "/dev/sdf"
          }
        },

    Clean Up / Refresh the Environment

    To refresh the environment, destroy your stack from the CloudFormation console.

    Delete Stack

    Then, go through the above steps again to create a fresh, new Fli client.

    Conclusion

    We hope this was useful! We will continue to post new blogs in this series, as well as use cases for Fli and FlockerHub. Stay tuned!

    More Details

    How FlockerHub works

    How Fli works

    Videos

    Fli Fundementals

    Better CI with FlockerHub and Fli

    Fli- Taking Snapshots

    FlockerHub- Updating Object Metadata

    FlockerHub- Creating Volumes

    Push and Pull Data Snapshots with Fli and FlockerHub

    How to setup Fli with your ZPool

    Using fli-docker to bootstrap Docker Compose Apps with data

    Use Cases

    Better CI: Integrate realistic data, accelerate your pipeline

    On-demand staging: Include realistic test data for each commit

    Test better: Easily create a scalable, distributed test fixture library

    Share error state: Collaboratively debug the most challenging errors

    On-demand dev environments: Share your workspace with anyone

    Like what you read?

    Signup for a free FlockerHub account.
    Sign Up

    Get all the ClusterHQ News

    Stay up to date with our newsletter. No spam. Ever.