I recently helped a friend setup the Gekko Trading Bot Platform on an AWS EC2 instance. Between the two of us it took about 2 hours.
It was not so much the complexity that was the issue but rather the number of customizations that needed to be made to suit the AWS environment.
Coming from a DevOps background, the first thing that came to my mind was: “This should be automated”. So I spent a couple of hours putting together a CloudFormation template that would deploy it automatically.
AWS CloudFormation allows you to specify infrastructure configuration (a.k.a. “Stacks”) as code. This provides a simple and repeatable way to build and deploy infrastructure on AWS. Further than that, it allows us to audit infrastructure changes and do deployments in a precise and consistent manner.
In this CloudFormation stack, I’ve specified the network configuration, the instances and an ECS service to run the Gekko platform. Elastic Container Service (ECS) is a free container orchestration service which makes use of docker containers to provide scalable and cost-effective application deployments.
Before you Launch this Stack
You will need the following before launching this Stack:
An active AWS account. If you do not have one you can sign up for free here. You will need to complete a minor mobile verification check and add a valid credit card number. You will only be charged for resources that you make use of – by default this stack will attempt use the minimum requirements to limit the cost.
Create an AWS EC2 KeyPair as described here. Keep this key safe as it will allow you to access your deployed EC2 instances if you need to in the future – you will not, however, need to connect to instances to deploy this stack.
What’s in this Stack?
This stack will launch the following:
- An EC2 instance optimized for running Docker Containers
- A Dockerized version of the Gekko software will be deployed to the instance
- A load-balancer in-front of the instance to efficiently route traffic to your application
Launching the Stack
When you click one of the links below, you will be redirected to the AWS CloudFormation interface.
|Region||Launch with new VPC|
|N. Virginia (us-east-1)||Deploy to AWS|
|Ohio (us-east-2)||Deploy to AWS|
|Oregon (us-west-2)||Deploy to AWS|
|Ireland (eu-west-1)||Deploy to AWS|
|Singapore (ap-southeast-1)||Deploy to AWS|
WARNING: Changing the default instance type and storage size will incur costs. Please be careful if you’re not sure.
Give your stack a name check the box for “I acknowledge that AWS CloudFormation might create IAM resources with custom names.” and choose Create.
Now’s time to grab a coffee while the stack deploys – the process should take about 10 minutes to complete. Once it has reached the
CREATE_COMPLETE state, click on “Outputs” to reveal the URL for your Gekko instance.
Navigate to the “WebsiteServiceURL” in your browser to see your new Gekko Server.
Addition Notes and Improvements
In the interest of transparency here are a few disclaimers:
The software deployed is not altered in any way for my own gain. The Dockerfile used to create the image is published in the
dockerfolder of this GitHub Repo – which is a fork of the original Gekko Repo.
The source for these CloudFormation templates are also freely available in a GitHub repo
Trading is at your own risk obviously
This deployment does not include creation of an SSL certificate or the addition of authentication on the server. I will update this stack with this in a future article.
With the Gekko Trading bot deployed, you can start to create and backtest your own trading bot algorithms.