https://pulumi.com logo
Title
c

cuddly-smartphone-15267

09/10/2021, 3:00 AM
I'm not sure if this is possible but basically when
ElasticBeanstalk
creates an
Environment
, one of the outputs is
autoscalingGroups
. I'd like to update the auto scaling group(s) to enable metrics collection. This doesn't appear to be possible in the EBS initialisation options so I think i might need to update it afterwards. i tried something like this:
const autoScalingGroup = Group.get(`autoscaling`, environment.autoscalingGroups[0]);
    autoScalingGroup.enabledMetrics = [`GroupDesiredCapacity`, `GroupInServiceCapacity`, `GroupPendingCapacity`, `GroupMinSize`, `GroupMaxSize`, `GroupInServiceInstances`, `GroupPendingInstances`, `GroupStandbyInstances`, `GroupStandbyCapacity`, `GroupTerminatingCapacity`, `GroupTerminatingInstances`, `GroupTotalCapacity`, `GroupTotalInstances`];
but the property is readonly
l

little-cartoon-10569

09/10/2021, 4:02 AM
It isn't possible to update any resource in Pulumi except via its constructor, and this automatically-generated ASG is not managed by Pulumi. You need to use the SDK for this.
c

cuddly-smartphone-15267

09/10/2021, 4:16 AM
ok.. so would the general process be to do something like: • add the autoscaling group as an output from the stack • after running
pulumi up
, run (something like) `aws autoscaling enable-metrics-collection --auto-scaling-group-name `pulumi stack output autoscalingGroup`` and that would form part of the 'build' script?
b

bored-table-20691

09/10/2021, 4:32 AM
Yes. Or you could also wrap this in the automation API.
c

cuddly-smartphone-15267

09/10/2021, 4:37 AM
could you elaborate on that pls Itay?
b

bored-table-20691

09/10/2021, 5:21 AM
Sorry, didn’t mean to be overly terse. 🙂 The benefit of the Pulumi automation API is that you can invoke your stack programmatically, reference the output programmatically, and then do something with the output. So in your case, you could create your stack by invoking the API, and then get the output of the stack (the ASG), and then call the AWS SDK with that ASG. An example that we do is we send an email to a user based on the stack output.
You can of course do this in a script as well, and in your case that might be just as easy.
c

cuddly-smartphone-15267

09/10/2021, 6:37 AM
no need to apologise 🙂 thanks heaps for the clarification though!