aws-gameservers
Version:
An experimental CDK Construct library.
167 lines (166 loc) • 4.85 kB
TypeScript
import { Construct } from "constructs";
import { CfnEIP, IInstance, InstanceType, ISecurityGroup, IVpc, UserData } from 'aws-cdk-lib/aws-ec2';
import { IRole } from 'aws-cdk-lib/aws-iam';
/**
* (experimental) Constructor properties that define the GameServer object.
*
* @experimental
*/
export interface GameServerProps {
/**
* (experimental) The name of the game being hosted on this GameServer.
*
* This is used for LogicalId sugar throughout the object.
*
* @experimental
*/
readonly game?: string;
/**
* (experimental) Optional: The VPC ID of the existing VPC in which to deploy the GameServer.
*
* @default A new VPC is created with 2 public subnets.
* @experimental
*/
readonly vpcId?: string;
/**
* (experimental) Optional: The GameServer's EC2 Instance type.
*
* @default InstanceType("t3.medium")
* @see https://aws.amazon.com/ec2/instance-types/
* @experimental
*/
readonly instanceType?: InstanceType;
/**
* (experimental) Optional: The desired size of the GameServer's root volume, in GB.
*
* Given value must be >= 15 to prevent the need for future volume expansion.
*
* @default 50
* @experimental
*/
readonly rootVolumeSize?: number;
/**
* (experimental) Optional: Whether to automatically release the GameServer's elastic IP address when the stack is torn down.
*
* Elastic IPs cost a nominal fee when reserved but unallocated.
* If you release an elastic IP, there is no way to guarantee that you'll ever get it back.
*
* @default false
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html
* @experimental
*/
readonly releaseIPOnDelete?: boolean;
/**
* (experimental) Optional: Whether to back up the GameServer.
*
* When true, the AWS Backup settings for the GameServer follow the "dailyMonthly1YearRetention" plan.
*
* @default true
* @experimental
*/
readonly backupGameServer?: boolean;
}
/**
* (experimental) Defines the overall expected shape of GameServer objects.
*
* @experimental
*/
export interface IGameServer {
/**
* (experimental) The name of the game being hosted on this GameServer.
*
* @experimental
*/
readonly game: string;
/**
* (experimental) The VPC where the GameServer is deployed.
*
* @experimental
*/
readonly vpc: IVpc;
/**
* (experimental) The EC2 Instance Object representing the GameServer itself.
*
* @experimental
*/
readonly server: IInstance;
/**
* (experimental) The Elastic IP Address attached to the GameServer.
*
* @experimental
*/
readonly elasticIp: CfnEIP;
/**
* (experimental) The modifiable UserData object attached to the GameServer Instance object.
*
* @experimental
*/
userData: UserData;
/**
* (experimental) The role associated with the GameServer's instance profile.
*
* @experimental
*/
serverRole: IRole;
/**
* (experimental) The security group attached to the GameServer Instance.
*
* @experimental
*/
securityGroup: ISecurityGroup;
}
/**
* (experimental) An abstract class representing an EC2 instance with an optional AWS Backup Plan, Elastic IP Address, and new or imported VPC.
*
* The GameServer abstract class is meant to be *extended* via the creation of child classes, e.g. ValheimServer, SatisfactoryServer.
*
* @experimental
*/
export declare abstract class GameServer extends Construct implements IGameServer {
/**
* (experimental) The name of the game being hosted on this GameServer.
*
* @experimental
*/
readonly game: string;
/**
* (experimental) The VPC where the GameServer is deployed.
*
* @experimental
*/
readonly vpc: IVpc;
/**
* (experimental) The EC2 Instance Object representing the GameServer itself.
*
* @experimental
*/
readonly server: IInstance;
/**
* (experimental) The Elastic IP Address attached to the GameServer.
*
* @experimental
*/
readonly elasticIp: CfnEIP;
/**
* (experimental) The modifiable UserData object attached to the GameServer Instance object.
*
* @experimental
*/
userData: UserData;
/**
* (experimental) The role associated with the GameServer's instance profile.
*
* @experimental
*/
serverRole: IRole;
/**
* (experimental) The security group attached to the GameServer Instance.
*
* @experimental
*/
securityGroup: ISecurityGroup;
/**
* @experimental
*/
constructor(scope: Construct, id: string, props: GameServerProps);
}