From 296dc129feecfced4ea669bd7e4112b95df70de0 Mon Sep 17 00:00:00 2001 From: Sam Hession Date: Mon, 22 Jul 2024 17:13:19 +0100 Subject: [PATCH] Add launch template detailed monitoring unit test --- src/patterns/ec2-app/base.test.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/patterns/ec2-app/base.test.ts b/src/patterns/ec2-app/base.test.ts index 41b2e0f5d6..6bf343f46e 100644 --- a/src/patterns/ec2-app/base.test.ts +++ b/src/patterns/ec2-app/base.test.ts @@ -1123,4 +1123,32 @@ UserData from accessed construct`); }, }); }); + + it("set detailed monitoring on the ASG launch template when set", function () { + const stack = simpleGuStackForTesting(); + new GuEc2App(stack, { + applicationPort: 3000, + app: "test-gu-ec2-app", + access: { scope: AccessScope.PUBLIC }, + instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.MEDIUM), + monitoringConfiguration: { noMonitoring: true }, + userData: UserData.forLinux(), + certificateProps: { + domainName: "domain-name-for-your-application.example", + }, + scaling: { + minimumInstances: 1, + }, + enabledDetailedInstanceMonitoring: true, + }); + Template.fromStack(stack).hasResource("AWS::EC2::LaunchTemplate", { + Properties: { + LaunchTemplateData: { + Monitoring: { + Enabled: true, + }, + }, + }, + }); + }); });