This section will deploy a pre-trained AI into your AWS account. This AI will expose the Battlesnake API.
The deployed architecture will consist of the following components:
Estimated cost : By default, the project will use a ml.t2.medium because newly created account can launch only this instance type. This instance cost $1.56 a day. If you have an account that exist for some time (typically more than a week) then you should be able to select ml.m5.xlarge instance which is included within the AWS Free tiers. The AWS Free tiers can support 500,000 snake API invocations over a 125 hour period per month for the first two months. The free tiers also include 250 hours per month of this notebook instance for the first two months. After the free tiers are exceeded, the charges will be approximately $6.5 per 24 hour period for m5 (and only $1.56 a day for t2 ) for the endpoint instance, $0.0582 per hour for the notebook instance, and $6 per million Snake API calls. Cost savings tip : Once you have finished working (ex: participating in games) you can stop your SageMaker notebook instance in order to stop consuming free tiers or incurring charges. You can easily restart these components at a later date in order to continue your work. You can also delete the SageMaker Inference Endpoint and recreate it when needed (manually or using the Deploy the SageMaker endpoint section of the heuristic dev notebook from Step 2). Keep in mind that the free-tiers instance apply only to one region, if you switch region you will loose the benefit of free tiers in the second region for the month. See pricing details: Amazon Sagemaker pricing, AWS Lambda pricing, Amazon API Gateway pricing
Use the links below to deploy the project into your preferred region*:
Region | deployment link |
---|---|
US West (Oregon) (us-west-2)** | deploy |
US East (N. Virginia) us-east-1 | deploy |
Canada (Central) ca-central-1 | deploy |
Europe (Ireland) eu-west-1 | deploy |
Asia Pacific (Sydney) ap-southeast-2 | deploy |
Note: Before deploying the environment, you need to be logged into the AWS account where you want to deploy the CloudFormation stack.
*The official Battlesnake platform runs in us-west-2. Selecting this region will provide you with the lowest latency
On the stack creation page you can optionally:
- customize your snake's appearance (color, head, tail)
- change the instance type for training and inference
Once done scroll down at the end of the page. Then check all permissions:
Click "Create Stack"
After about 15 minutes, the stack status should be CREATE_COMPLETE.
Navigate to Amazon SageMaker and click the "[Open JupyterLab]" in the Battlesnake notebook instance.
Open the 1_Introduction.ipynb
notebook for next steps.
Once you finish your work for the day or you finish participating in games with your snake, you can stop your instances:
- To stop the notebook instance (dev environment) go to Amazon Sagemaker in the AWS console, navigate to 'notebook instances', select your instance, click action, and choose stop.
- To stop the endpoint instance (dev environment) go to Amazon Sagemaker in the AWS console, navigate to 'inference endpoints', select your endpoint and delete it.
Go to Step 2 to start making changes to the snake's behavior.
To clean up the environment, go to AWS CloudFormation within the AWS console, select your sagemaker-soln-bs stack, and click 'delete'.
WARNING : Deleting your stack will erase the Battlesnake environment data, and any code changes. Make sure that you have saved your work before doing this! One way to do that is to setup source control.