millions-furniture-75402
06/24/2021, 12:34 PMconst myEc2 = new aws.ec2.Instance(...);
myEc2.id.apply(
myEc2Id =>
new aws.cloudwatch.LogGroup(`${appName}-ec2-lg`, {
name: `/custom/ec2/${appName}/${myEc2Id}`,
retentionInDays: 14,
}),
);
I would think I could retrieve a collection of EC2 Instances from the autoscaling group, but I’m not finding that to be true. https://www.pulumi.com/docs/reference/pkg/aws/autoscaling/group/#outputsbrave-planet-10645
06/24/2021, 12:49 PMmillions-furniture-75402
06/24/2021, 1:02 PM<appName>-<availabilityZone>
as the name.brave-planet-10645
06/24/2021, 1:13 PMmillions-furniture-75402
06/24/2021, 1:14 PMName: <appName>-<availabilityZone>
brave-planet-10645
06/24/2021, 5:06 PMappName
(although you can tag them whatever you want)
Then I'm getting the instances using aws.ec2.getInstances()
(worth noting that the instance data that's returned is not the same as on the aws.ec2.Instance
resource)
const myAppName = "pk-app";
let instances = pulumi.output(aws.ec2.getInstances({
instanceTags: {
appName: myAppName
}
}));
instances.ids.apply(ids => {
ids.map(id => {
new aws.cloudwatch.LogGroup(`${appName}-ec2-lg`, {
name: pulumi.interpolate`/custom/ec2/${myAppName}/${id}`,
retentionInDays: 14
})
})
});
millions-furniture-75402
06/25/2021, 9:13 PM