Repository: cdklabs/cdk-monitoring-constructs (language: python)

Issue:
[core] Use Graviton for Lambda handlers
### Feature scope

Lambda handlers

### Describe your suggested feature

We currently have some Lambda handlers (secrets metrics publisher and bitmap dashboard widget renderer) that'd benefit from being migrated to Graviton since they're cheaper.


Discussion / hints:

Fix patch:
diff --git a/lib/dashboard/widget/BitmapWidget.ts b/lib/dashboard/widget/BitmapWidget.ts
index bfc4f65d..2d513ccb 100644
--- a/lib/dashboard/widget/BitmapWidget.ts
+++ b/lib/dashboard/widget/BitmapWidget.ts
@@ -3,7 +3,13 @@ import * as path from "path";
 import { Duration, Tags } from "aws-cdk-lib";
 import { IWidget } from "aws-cdk-lib/aws-cloudwatch";
 import { Effect, PolicyStatement } from "aws-cdk-lib/aws-iam";
-import { Code, Function, IFunction, Runtime } from "aws-cdk-lib/aws-lambda";
+import {
+  Architecture,
+  Code,
+  Function,
+  IFunction,
+  Runtime,
+} from "aws-cdk-lib/aws-lambda";
 import { RetentionDays } from "aws-cdk-lib/aws-logs";
 import { Construct } from "constructs";
 
@@ -35,6 +41,7 @@ export class BitmapWidgetRenderingSupport extends Construct {
       handler: "index.handler",
       memorySize: 128,
       runtime: Runtime.NODEJS_14_X,
+      architecture: Architecture.ARM_64,
       timeout: Duration.seconds(60),
       logRetention: RetentionDays.ONE_DAY,
     });
diff --git a/lib/monitoring/aws-secretsmanager/SecretsManagerMetricsPublisher.ts b/lib/monitoring/aws-secretsmanager/SecretsManagerMetricsPublisher.ts
index fab8314a..334b7320 100644
--- a/lib/monitoring/aws-secretsmanager/SecretsManagerMetricsPublisher.ts
+++ b/lib/monitoring/aws-secretsmanager/SecretsManagerMetricsPublisher.ts
@@ -4,7 +4,13 @@ import { Duration, Names } from "aws-cdk-lib";
 import { Rule, RuleTargetInput, Schedule } from "aws-cdk-lib/aws-events";
 import { LambdaFunction } from "aws-cdk-lib/aws-events-targets";
 import { Effect, PolicyStatement } from "aws-cdk-lib/aws-iam";
-import { Code, Function, IFunction, Runtime } from "aws-cdk-lib/aws-lambda";
+import {
+  Architecture,
+  Code,
+  Function,
+  IFunction,
+  Runtime,
+} from "aws-cdk-lib/aws-lambda";
 import { RetentionDays } from "aws-cdk-lib/aws-logs";
 import { ISecret } from "aws-cdk-lib/aws-secretsmanager";
 import { Construct } from "constructs";
@@ -35,6 +41,7 @@ export class SecretsManagerMetricsPublisher extends Construct {
       handler: "index.handler",
       memorySize: 128,
       runtime: Runtime.NODEJS_14_X,
+      architecture: Architecture.ARM_64,
       timeout: Duration.seconds(60),
       logRetention: RetentionDays.ONE_DAY,
     });


Test patch:
diff --git a/test/dashboard/widget/__snapshots__/BitmapWidget.test.ts.snap b/test/dashboard/widget/__snapshots__/BitmapWidget.test.ts.snap
index abba281d..95ab3f38 100644
--- a/test/dashboard/widget/__snapshots__/BitmapWidget.test.ts.snap
+++ b/test/dashboard/widget/__snapshots__/BitmapWidget.test.ts.snap
@@ -94,6 +94,9 @@ Object {
         "SupportLambdaServiceRole250832F3",
       ],
       "Properties": Object {
+        "Architectures": Array [
+          "arm64",
+        ],
         "Code": Object {
           "S3Bucket": Object {
             "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}",
diff --git a/test/facade/__snapshots__/MonitoringAspect.test.ts.snap b/test/facade/__snapshots__/MonitoringAspect.test.ts.snap
index 06eaa694..333e1a83 100644
--- a/test/facade/__snapshots__/MonitoringAspect.test.ts.snap
+++ b/test/facade/__snapshots__/MonitoringAspect.test.ts.snap
@@ -5912,6 +5912,9 @@ Object {
         "MonitoringFacadeSecretsManagerMetricsPublisherLambdaServiceRole7F0151FB",
       ],
       "Properties": Object {
+        "Architectures": Array [
+          "arm64",
+        ],
         "Code": Object {
           "S3Bucket": Object {
             "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}",
diff --git a/test/monitoring/aws-secretsmanager/__snapshots__/SecretsManagerSecretMonitoring.test.ts.snap b/test/monitoring/aws-secretsmanager/__snapshots__/SecretsManagerSecretMonitoring.test.ts.snap
index 775f1dab..5e9a0abf 100644
--- a/test/monitoring/aws-secretsmanager/__snapshots__/SecretsManagerSecretMonitoring.test.ts.snap
+++ b/test/monitoring/aws-secretsmanager/__snapshots__/SecretsManagerSecretMonitoring.test.ts.snap
@@ -94,6 +94,9 @@ Object {
         "ScopeSecretsManagerMetricsPublisherLambdaServiceRoleEC4B8B08",
       ],
       "Properties": Object {
+        "Architectures": Array [
+          "arm64",
+        ],
         "Code": Object {
           "S3Bucket": Object {
             "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}",
@@ -420,6 +423,9 @@ Object {
         "ScopeSecretsManagerMetricsPublisherLambdaServiceRoleEC4B8B08",
       ],
       "Properties": Object {
+        "Architectures": Array [
+          "arm64",
+        ],
         "Code": Object {
           "S3Bucket": Object {
             "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}",