/cloud-td

CDK stack for running TouchDesigner on AWS

Primary LanguageTypeScript

RenderLab

Welcome to the RenderLab! This project provides cloud-based virtual workstations with GPU accelerators for AI generative graphics workloads. The application leverages Next.js for the web interface and AWS CDK for deploying the infrastructure to AWS.

Directory Structure

  • web: Contains the Next.js application code.
  • cdk: Contains AWS CDK code for deploying the infrastructure.

Getting Started

Prerequisites

  1. Node.js (version 16 or above)
  2. AWS CLI
  3. AWS CDK
  4. AWS EC2 Key Pair (.pem)

Setting Up the Web Application

  1. Navigate to the web directory:

    cd web
  2. Install dependencies:

    npm install
  3. Run the development server:

    npm run dev

    Your application will start at http://localhost:3000.

Deploying the Infrastructure with AWS CDK

This repository contains the necessary CDK code for deploying graphics-optimized cloud workstations on AWS.

Solution Overview

1. Navigate to the cdk directory:

cd cdk

2. Install dependencies:

npm install

3. Review Configuration:

Edit cdk/bin/renderlab.ts to configure the parameters:

  • ACCOUNT and REGION: Your AWS account ID and region.
  • NICE_DCV_DISPLAY_DRIVER_URL, NICE_DCV_SERVER_URL: Download URLs for NICE DCV components.
  • InstanceSize: E.g., g5.xlarge, g4dn.xlarge.
  • associateElasticIp, EC2_KEYPAIR_NAME, VOLUME_SIZE_GIB, OPEN_PORTS, ALLOW_INBOUND_CIDR, GRID_SW_CERT_URL, tags, SEVEN_ZIP_URL, CHROME_URL: Various configurations related to the EC2 instance.
  1. Bootstrap your environment: (Only required once per account/region)
cdk bootstrap
  1. Deploy the stack:
cdk deploy <StackName>

Replace <StackName> with your desired stack name.

Useful CLI Commands

List EC2 key pairs

aws ec2 describe-key-pairs --query 'KeyPairs[*].KeyName' --output table

Create a new key pair and save the PEM file

KEY_NAME=GamingOnEc2
aws ec2 create-key-pair --key-name $KEY_NAME --query 'KeyMaterial' --output text > $KEY_NAME.pem

Start/Stop an EC2 instance

aws ec2 start-instances --instance-ids INSTANCE_ID
aws ec2 stop-instances --instance-ids INSTANCE_ID

Create an AMI

aws ec2 create-image --instance-id <YOUR_INSTANCE_ID> --name <AMI_NAME>

Start an instance from a launch template

aws ec2 run-instances --image-id <YOUR_AMI_ID> --launch-template LaunchTemplateName=<TEMPLATE_NAME> --query "Instances[*].[InstanceId, PublicIpAddress]" --output table

List instances

aws ec2 describe-instances --query "Reservations[*].Instances[*].[ImageId, InstanceType, VpcId, State.Name, PublicIpAddress, LaunchTime]" --output table

Deploy all stacks without rollback and approval for IAM resources

cdk deploy --all --no-rollback --concurrency=3 --require-approval=never

List all stacks

cdk list

Tail CloudFormation logs

Get-Content -Path C:\cfn\log\cfn-init.log -Wait