clever-glass-42863
06/28/2022, 6:58 PMattach-instances
command from the AWS package so we can attach an EC2 instance to an AutoScaleGroup? I see the Attachment resource, however I don't see the parameters to specify a launched EC2 instance. Any help would be appreciated.billowy-army-68599
clever-glass-42863
06/28/2022, 7:19 PMhost
networkMode which then requires a distinctInstance
configuration from the auto scale perspective. This is fine, except when trying to do rolling updates. Since we have a desired count for the service, if we are currently servicing our desired count, the auto scale group doesn't create an additional EC2 instance to account for the task placement. Therefore our strategy was to always spin up n+ EC2 instances as needed to serve the rolling deployment. The use case then is to attach the newly created EC2 instance (outside of the scale group) to the scaling group so that it is tracked appropriately.billowy-army-68599
clever-glass-42863
06/28/2022, 7:23 PM// attach-instances hack work around...
_ = Output.Tuple(ec2Instance.Id, clusterAutoScalingGroup.Name).Apply(async x =>
{
using (var client = new Amazon.AutoScaling.AmazonAutoScalingClient(Amazon.RegionEndpoint.USWest1))
{
// This +1 the desired capacity, so you may want to wait for deploymenet then reduce the desired capacity...
await client.AttachInstancesAsync(new Amazon.AutoScaling.Model.AttachInstancesRequest
{
InstanceIds = new List<string> { x.Item1 },
AutoScalingGroupName = x.Item2
});
}
// We don't care about the results...
return string.Empty;
});