-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloud-gaming-on-ec2.ts
53 lines (47 loc) · 1.81 KB
/
cloud-gaming-on-ec2.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* tslint:disable:no-import-side-effect no-submodule-imports no-unused-expression */
import "source-map-support/register";
import { G4ADStack } from "../lib/g4ad";
import {App} from "aws-cdk-lib";
import {InstanceSize} from "aws-cdk-lib/aws-ec2";
const app = new App();
const NICE_DCV_DISPLAY_DRIVER_URL = "https://d1uj6qtbmh3dt5.cloudfront.net/Drivers/nice-dcv-virtual-display-x64-Release-34.msi";
const NICE_DCV_SERVER_URL = "https://d1uj6qtbmh3dt5.cloudfront.net/2021.0/Servers/nice-dcv-server-x64-Release-2021.0-10242.msi";
const VOLUME_SIZE_GIB = 150;
const OPEN_PORTS = [3389, 8443];
const ACCOUNT_ID = "PLACEHOLDER"
const REGION = "us-east-1"
const VPC_ID = 'PLACEHOLDER'
const SUBNET_ID = 'PLACEHOLDER'
const SUBNET_AVAILABILITY_ZONE = 'PLACEHOLDER'
const user = app.node.tryGetContext("user");
if (!user) {
throw new Error("User is a required parameter. Specify it with `-c user=me`.");
}
const localIp = app.node.tryGetContext("localIp");
if (!localIp) {
throw new Error("Local IP is a required parameter. Specify it with '-c localIp=XXX.XXX.XXX.XXX'.");
}
const sshKeyName = process.env.AWS_CLOUD_GAMING_SSH_KEY;
if (!sshKeyName) {
throw new Error("SSH key name is a required parameter. Specify it by setting the environment variable 'AWS_CLOUD_GAMING_SSH_KEY'.");
}
new G4ADStack(app, `TeamBuildingCloudGaming-${user}`, {
niceDCVDisplayDriverUrl: NICE_DCV_DISPLAY_DRIVER_URL,
niceDCVServerUrl: NICE_DCV_SERVER_URL,
instanceSize: InstanceSize.XLARGE4,
sshKeyName,
volumeSizeGiB: VOLUME_SIZE_GIB,
openPorts: OPEN_PORTS,
allowInboundCidr: `${localIp}/32`,
env: {
account: ACCOUNT_ID,
region: REGION
},
tags: {
"Application": "cloud-gaming"
},
user,
vpcId: VPC_ID,
subnetId: SUBNET_ID,
subnetAvailabilityZone: SUBNET_AVAILABILITY_ZONE
});