Require the user to specify the AZ for the subnet
This commit is contained in:
@@ -21,11 +21,12 @@ This repo will automate the creation and connection to an AWS EC2 spot instance
|
||||
Modify the following properties in the [cloud-gaming-on-ec2](cdk/bin/cloud-gaming-on-ec2.ts) stack:
|
||||
|
||||
| Parameter Name | Description |
|
||||
|----------------|---------------------------------------------------------------------|
|
||||
|----------------------------|---------------------------------------------------------------------|
|
||||
| `ACCOUNT_ID` | The AWS account ID you want to use |
|
||||
| `REGION` | The AWS region in which you want the resources created |
|
||||
| `VPC_ID` | The ID of the VPC you wish to deploy the instance into |
|
||||
| `SUBNET_ID` | The ID of a public subnet that you want your instance deployed into |
|
||||
| `SUBNET_AVAILABILITY_ZONE` | The availability zone of the subnet you provided |
|
||||
|
||||
## Running the application
|
||||
To run the application, simply run the `cloud-gaming.sh` script in the root directory and follow all instructions/menu choices and the script will take care of everything else!
|
||||
|
||||
@@ -166,12 +166,6 @@ deployCdk() {
|
||||
} | whiptail --title "Preparing CDK..." --gauge "Preparing CDK..." "$GAUGE_BOX_HEIGHT" "$GAUGE_BOX_WIDTH" 0
|
||||
|
||||
declare pid
|
||||
declare synthLogFile="${logFile}-synth.log"
|
||||
printInfo "Running CDK synth and logging to $synthLogFile"
|
||||
yes | npx cdk --no-color --require-approval never --profile $AWS_CLOUD_GAMING_PROFILE -c "user=$user" -c "localIp=$localIp" synth "TeamBuildingCloudGaming-$user" > $synthLogFile 2>&1 &
|
||||
pid=$!
|
||||
showTailBox "Synthesizing CDK" $pid $synthLogFile
|
||||
|
||||
declare bootstrapLogFile="${logFile}-bootstrap.log"
|
||||
printInfo "Bootstrapping CDK and logging to $bootstrapLogFile"
|
||||
yes | npx cdk --no-color --require-approval never --profile $AWS_CLOUD_GAMING_PROFILE -c "user=$user" -c "localIp=$localIp" bootstrap > $bootstrapLogFile 2>&1 &
|
||||
|
||||
@@ -14,6 +14,7 @@ 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) {
|
||||
@@ -47,5 +48,6 @@ new G4ADStack(app, `TeamBuildingCloudGaming-${user}`, {
|
||||
},
|
||||
user,
|
||||
vpcId: VPC_ID,
|
||||
subnetId: SUBNET_ID
|
||||
subnetId: SUBNET_ID,
|
||||
subnetAvailabilityZone: SUBNET_AVAILABILITY_ZONE
|
||||
});
|
||||
|
||||
+3
-2
@@ -22,6 +22,7 @@ export interface BaseConfig extends StackProps {
|
||||
readonly instanceSize: InstanceSize;
|
||||
readonly vpcId: string;
|
||||
readonly subnetId: string;
|
||||
readonly subnetAvailabilityZone: string;
|
||||
readonly sshKeyName: string;
|
||||
readonly volumeSizeGiB: number;
|
||||
readonly niceDCVDisplayDriverUrl: string;
|
||||
@@ -37,7 +38,7 @@ export abstract class BaseEc2Stack extends Stack {
|
||||
constructor(scope: App, id: string, props: BaseConfig) {
|
||||
super(scope, id, props);
|
||||
this.props = props;
|
||||
const { vpcId, subnetId, sshKeyName, volumeSizeGiB, openPorts, allowInboundCidr, user } = props;
|
||||
const { vpcId, subnetId, subnetAvailabilityZone, sshKeyName, volumeSizeGiB, openPorts, allowInboundCidr, user } = props;
|
||||
const vpc = Vpc.fromLookup(this, "Vpc", { vpcId });
|
||||
|
||||
const securityGroup = new SecurityGroup(this, `SecurityGroup-${user}`, {
|
||||
@@ -82,7 +83,7 @@ export abstract class BaseEc2Stack extends Stack {
|
||||
instanceType: this.getInstanceType(),
|
||||
vpc,
|
||||
securityGroup,
|
||||
vpcSubnets: vpc.selectSubnets({ subnets: [Subnet.fromSubnetAttributes(this, 'publicSubnet', {subnetId, availabilityZone: "us-east-1a"})] }),
|
||||
vpcSubnets: vpc.selectSubnets({ subnets: [Subnet.fromSubnetAttributes(this, 'publicSubnet', {subnetId, availabilityZone: subnetAvailabilityZone})] }),
|
||||
keyName: sshKeyName,
|
||||
userData: this.getUserdata(),
|
||||
machineImage: MachineImage.latestWindows(WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE),
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ verifyPrerequisites() {
|
||||
printWarn "Installing the FlatHub repo for Flatpak if it doesn't already exist..."
|
||||
echo "$SUDO_PASSWORD" | sudo -k -S flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
printWarn "Installing SteamLink from FlatHub..."
|
||||
echo "$SUDO_PASSWORD" | sudo -k -S flatpak install flathub com.valvesoftware.SteamLink
|
||||
echo "$SUDO_PASSWORD" | sudo -k -S flatpak install -y flathub com.valvesoftware.SteamLink
|
||||
fi
|
||||
# elif [[ $KERNEL == "Darwin" ]]; then
|
||||
# TODO check if SteamLink is installed, and if not, install it via mas-cli
|
||||
|
||||
Reference in New Issue
Block a user