Greetings, is there a way to invoke the `attach-in...
# general
Greetings, is there a way to invoke the
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.
I don't believe this is supported at the moment. Can youy talk more about what you're trying to do?
Thanks for the reply. We have a EC2 launch type service that runs game servers via UDP. The EC2 itself is in
networkMode which then requires a
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.
AWS supports this mechanism via the GUI and CLI. However, I do not see a matching Terraform resource either.
that's a great run down, appreciate the insight!
if it's not in the tf provider, we won't have support for it It doesn't appear to be in the cloud control API yet either:
Sounds good. We'll find a workaround. I appreciate the quick response
Here is a non-pulumi workaround in C# if anyone runs into this. It does require the use of the Amazon Sdk
Copy code
// 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;
👍 1