Giter VIP home page Giter VIP logo

aws-gaming-cloudformation's Introduction

Cloudformation Gamer Setup with AMD, NICE DCV and Steam

This template builds the infrastructure and Ubuntu 18.04 based AMI with Nice DCV, AMD drivers for g4ad machines and installs Steam for linux. It utilizes Spot Instances.

It creates or recovers an EBS volume from a snapshot and mounts it to /home/gamer and using lifecycle hooks and event rules attempts to snapshot the EBS volume on tear down.

This stack also creates an IAM user that has permissions to only change the desired capacity of the AutoScaling Group that manages the instances.

Their credentials are in the outputs of the Cloudformation stack.

Your CIDR is required to limit access to your current location.

The gamer user on linux is given automatic login and no password required Nice DCV. Alter the template if that is a problem.

!!!!!Important!!!!!

Machines must be spun down by either a spot instance terminating event or the AutoScaling Group changing its capacity. Otherwise no snapshotting or automatic EBS mounting will occur.

Please do not rely on snapshotting to work! I am not responsible for lost data.

There is no snapshot cleanup at this time. You will have to manually remove old snapshots. If anything fails you may have old EBS volumes laying around.

Your AWS bill may get large! I suggest setting up billing alerts, your bill is not my problem.

This comes with no guarantees!

Required

  • awscli
  • Nice DCV client
  • A quota increase on your AWS account for g4ad spot instances

Launching

Generate a parameters file.

./addcidr.sh > myparameters.json

Create a password for the gamer user

aws secretsmanager create-secret --name gamer-secret-password --secret-string 'yourpasswordhere'

Password gets set every time a machine starts so you can update the password anytime before a scale out event.

Create the stack

aws cloudformation create-stack --stack-name gamer-infra \
	--template-body file://gamer-infra.yaml \
	--capabilities CAPABILITY_NAMED_IAM --parameters file://myparameters.json

Then create the AMI

aws cloudformation create-stack --stack-name amd-linux-steam-ami \
	--template-body file://amd-linux-steam-ami.yaml \
	--capabilities CAPABILITY_NAMED_IAM

Get coffee image build takes about an hour.

When stack is complete you have built a new AMI and your stack is ready to deploy.

Update the infra stack replacing the ImageId with your new image id reference in the parameters file.

[
  {
    "ParameterKey": "RootVolumeSize",
    "ParameterValue": "30"
  },
  {
    "ParameterKey": "HomeVolumeSize",
    "ParameterValue": "1000"
  },
  {
    "ParameterKey": "GamerInstance",
    "ParameterValue": "g4ad.xlarge"
  },
  {
    "ParameterKey": "ImageId",
    "ParameterValue": "/gamer/images/amd-ubuntu-dcv-steam"
  }

]
aws cloudformation update-stack --stack-name gamer-infra \
	--template-body file://gamer-infra.yaml \
	--capabilities CAPABILITY_NAMED_IAM --parameters file://myparameters.json

Scale your Autoscaling Group to 1.

When your instance is running you can connect your Nice DCV client.

<Instance IP>:8443#gamer

I cannot help with networking issues due to your home setup.

Deleting

Delete the stack and then clean up any snapshots and AMIs you may have laying around.

Roadmap

  • Lambda to clean up old snapshots based on n snapshots to retain.
  • SMS to warn of spot termination
  • Automatic scale in when Nice DCV session has been idle for n minutes
  • Tagging
  • Billing alerts
  • Other image recipes

aws-gaming-cloudformation's People

Contributors

jasonrichardsmith avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

stenwt

aws-gaming-cloudformation's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.