Skip to content

Instantly share code, notes, and snippets.

@kritro
Last active May 20, 2021 07:02
Show Gist options
  • Select an option

  • Save kritro/1e45ab8715d26aaa019a121987f6a34f to your computer and use it in GitHub Desktop.

Select an option

Save kritro/1e45ab8715d26aaa019a121987f6a34f to your computer and use it in GitHub Desktop.
// Finally lets provision our ec2 instance
instance = new ec2.Instance(this, "app-mysql-server-instance", {
vpc: vpc,
role: role,
securityGroup: securityGroup,
instanceName: servername,
instanceType: instancetype,
blockDevices:[
{
deviceName: '/dev/sda1',
volume: ec2.BlockDeviceVolume.ebs(volumeCsize),
}
// ,
// {
// deviceName : "/dev/sdm",
// volume : ec2.BlockDeviceVolume.ebs(volumeDsize)
// }
],
machineImage: genericWindows,
vpcSubnets: subnet,
// userData: userData,
// privateIpAddress: privateIp,
init: initData,
initOptions: {
timeout: cdk.Duration.minutes(35),
ignoreFailures: false,
},
keyName: serverkey, // we will create this in the console before we deploy
})
dVolume.grantAttachVolume(instance);
instance.instance.overrideLogicalId('mysqlinstance');
cdk.Tags.of(instance).add("Name", servername);
cdk.Tags.of(instance).add("Application", application);
cdk.Tags.of(instance).add("Description", serverdescription);
cdk.Tags.of(instance).add("CreatedBy", createdBy);
cdk.Tags.of(instance).add("Environment", environment);
cdk.Tags.of(instance).add("OS", os););
cdk.Tags.of(instance).add("Country", country);
cdk.Tags.of(instance).add("Legal Entity", legalEntitiy);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment