in dcv_session_manager_infrastructure/dcv_session_manager_infrastructure_stack.py [0:0]
def create_asg(self, asg_type, vpc, instance_type, ami, userdata, role, key_name, capacity, security_group, device_name, volume_size):
# ASG
asg = autoscaling.AutoScalingGroup(
self,
"ASG_"+asg_type,
auto_scaling_group_name="ASG_"+asg_type,
vpc=vpc,
vpc_subnets=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PUBLIC),
instance_type=ec2.InstanceType(instance_type),
machine_image=ami,
user_data=userdata,
role=role,
key_name=key_name,
desired_capacity=capacity,
min_capacity=capacity,
max_capacity=capacity,
security_group=security_group,
signals=autoscaling.Signals.wait_for_count(
capacity, timeout=core.Duration.minutes(30)),
block_devices=[
autoscaling.BlockDevice(
device_name=device_name,
volume=autoscaling.BlockDeviceVolume.ebs(
volume_type=autoscaling.EbsDeviceVolumeType.GP2,
volume_size=volume_size,
delete_on_termination=True
)
)]
)
return asg