Getting Started with Fli: Using AWS CloudFormation
Fli is a command line interface that you can use to deploy a stack with CloudFormation and snapshot, clone, push, and pull data volumes to FlockerHub.
Join the DZone community and get the full member experience.
Join For FreeThis 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
- An AWS account. You can sign up for free here.
- An SSH client.
ssh
from a Linux or Mac terminal, or something like PuTTY on Windows.
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 Into AWS CloudFormation
Next, click Create Stack
in the top left.
Set Up the Template and Deploy Your Stack
Choose the template from the examples repository.
You will use the Upload a template to Amazon S3
.
Click Next
, then enter a Stack name
and an SSH Key.
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.
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.
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
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.
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
Videos
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.
Published at DZone with permission of Ryan Wallner, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments