Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New serverless pattern - lambda cloudwatch metrics and dashboard in cdk - dotnet #1264

Closed
wants to merge 18 commits into from

Conversation

srcsakthivel
Copy link
Contributor

Description of changes:

This pattern helps build CloudWatch Dashboard with AWS Lambda Metrics. The Dashboard built with 4 widgets,

  • Invocations - from AWS/Lambda Namespace
  • memory_utilization - from LambdaInsights Namespace
  • cpu_total_time - from LambdaInsights Namespace
  • Custom Metrics (Proxy-Request & Proxy-Successful) - from Custom Namespace

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@srcsakthivel srcsakthivel changed the title feature - lambda cloudwatch metrics and dashboard in cdk - dotnet New serverless pattern - lambda cloudwatch metrics and dashboard in cdk - dotnet Apr 20, 2023
@mavi888
Copy link
Contributor

mavi888 commented Apr 25, 2023

@srcsakthivel there are some issues with this pattern. please fix them and then i can proceed with the review.
Thanks a lot :)

@srcsakthivel
Copy link
Contributor Author

@srcsakthivel there are some issues with this pattern. please fix them and then i can proceed with the review. Thanks a lot :)

Thanks for the review and valuable feedback. I have made the updates and ready for your review.

@mavi888
Copy link
Contributor

mavi888 commented May 8, 2023

Im following the instructions and when running cdk deploy I get this error

 > [final 1/4] RUN curl -O https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm:
------
executor failed running [/bin/sh -c curl -O https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm]: exit code: 1
[100%] fail: docker build --build-arg INSIGHTSEXTENSION=https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm --tag cdkasset-e9eebc1615af63afd939405af9d1a647c352ca881864f6f633792d33e3a1a149 . exited with error code 1: #1 [internal] load build definition from Dockerfile
#1 sha256:d48cb0f3d1dc57e0421eb713a89d0ac4afdd35254781a0679351d405006d147a
#1 transferring dockerfile: 37B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 sha256:2336b7ffb9df97652f688ddbb5d83b5c2ed0b1ef0aad790ac7e3ea715fda5ac6
#2 transferring context: 2B done
#2 DONE 0.0s

#4 [internal] load metadata for public.ecr.aws/lambda/dotnet:6
#4 sha256:bc7065f21dee32ea7736ecb265d6ad759ce7f172f06256d480fe7154ca7f9074
#4 ...

#3 [internal] load metadata for mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim
#3 sha256:3958982a3cf434b4942b75846a4c6ed5d14bc6423ddd7d25d603df9ba4fd2d51
#3 ...

#4 [internal] load metadata for public.ecr.aws/lambda/dotnet:6
#4 sha256:bc7065f21dee32ea7736ecb265d6ad759ce7f172f06256d480fe7154ca7f9074
#4 DONE 58.4s

#3 [internal] load metadata for mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim
#3 sha256:3958982a3cf434b4942b75846a4c6ed5d14bc6423ddd7d25d603df9ba4fd2d51
#3 DONE 103.3s

#5 [base 1/1] FROM public.ecr.aws/lambda/dotnet:6@sha256:558585dcae0babe95cebed56d1f84eac663d0f361273c262497af60410140743
#5 sha256:36f3c92f00a1c0f0c06c1d59750707d35efc8afe1ccddf112117a5975257eaca
#5 CACHED

#11 [internal] load build context
#11 sha256:40ddb63ac496046edf37cfd93ffac2adc83f233b5f5d847ab4ce4fe7f4de2ca0
#11 DONE 0.0s

#9 [build 1/7] FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim@sha256:fda5db18bc50cd935a424b08c0237f6bc9f9f9559f72e3076858454e0b59a4d5
#9 sha256:6eb9424c33071cb48aa448595f8b2e8c48ac986a9135ec43629c8db9f505b745
#9 resolve mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim@sha256:fda5db18bc50cd935a424b08c0237f6bc9f9f9559f72e3076858454e0b59a4d5 0.0s done
#9 DONE 0.0s

#6 [final 1/4] RUN curl -O https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm
#6 sha256:497b4ae33e3cf375811f89e8ed7b1d7234490a26ba6a440f2483379375fcf143
#6 ...

#11 [internal] load build context
#11 sha256:40ddb63ac496046edf37cfd93ffac2adc83f233b5f5d847ab4ce4fe7f4de2ca0
#11 transferring context: 181B done
#11 DONE 0.0s

#9 [build 1/7] FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim@sha256:fda5db18bc50cd935a424b08c0237f6bc9f9f9559f72e3076858454e0b59a4d5
#9 sha256:6eb9424c33071cb48aa448595f8b2e8c48ac986a9135ec43629c8db9f505b745
#9 sha256:fda5db18bc50cd935a424b08c0237f6bc9f9f9559f72e3076858454e0b59a4d5 1.11kB / 1.11kB done
#9 sha256:5468fcfb7b1376bed09389195d4753bba08539e5cf0a0e33c39af7e318486f51 2.01kB / 2.01kB done
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 0B / 29.31MB 0.2s
#9 sha256:a9ff2c65eb3a5852745e26674f4c9ba218b2ac584bf7dd99ee6001de4d290693 7.23kB / 7.23kB done
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 0B / 30.05MB 0.2s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 0B / 15.12MB 0.2s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 2.10MB / 15.12MB 0.7s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 2.10MB / 30.05MB 0.9s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 3.15MB / 15.12MB 0.9s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 4.19MB / 15.12MB 1.0s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 5.24MB / 15.12MB 1.1s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 8.39MB / 15.12MB 1.3s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 9.44MB / 15.12MB 1.4s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 11.53MB / 15.12MB 1.8s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 14.68MB / 15.12MB 2.2s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 2.10MB / 29.31MB 2.4s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 4.19MB / 30.05MB 2.4s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 15.12MB / 15.12MB 2.2s done
#9 sha256:c62ac8d27e066992fdb652b8153a79da426a395658dea45a1ba64600725953e5 0B / 155B 2.4s
#9 sha256:c62ac8d27e066992fdb652b8153a79da426a395658dea45a1ba64600725953e5 155B / 155B 2.6s done
#9 sha256:a3d230d1c3dd4eee3f609d4ca58088b74e3f6b1d4a727b2afff9a63e2a5f6e22 0B / 9.07MB 2.6s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 5.24MB / 29.31MB 2.8s
#9 sha256:a3d230d1c3dd4eee3f609d4ca58088b74e3f6b1d4a727b2afff9a63e2a5f6e22 1.05MB / 9.07MB 3.0s
#9 sha256:a3d230d1c3dd4eee3f609d4ca58088b74e3f6b1d4a727b2afff9a63e2a5f6e22 4.19MB / 9.07MB 3.2s
#9 sha256:a3d230d1c3dd4eee3f609d4ca58088b74e3f6b1d4a727b2afff9a63e2a5f6e22 6.29MB / 9.07MB 3.3s
#9 sha256:a3d230d1c3dd4eee3f609d4ca58088b74e3f6b1d4a727b2afff9a63e2a5f6e22 8.39MB / 9.07MB 3.4s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 7.34MB / 29.31MB 3.6s
#9 sha256:a3d230d1c3dd4eee3f609d4ca58088b74e3f6b1d4a727b2afff9a63e2a5f6e22 9.07MB / 9.07MB 3.4s done
#9 sha256:fdce0a3c2fd6842a6e21798d4bd43ac4003c6ea29718264961ac41fc95295ff5 0B / 25.39MB 3.6s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 9.44MB / 29.31MB 3.8s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 11.53MB / 29.31MB 4.2s
#9 sha256:fdce0a3c2fd6842a6e21798d4bd43ac4003c6ea29718264961ac41fc95295ff5 4.19MB / 25.39MB 4.2s
#9 sha256:fdce0a3c2fd6842a6e21798d4bd43ac4003c6ea29718264961ac41fc95295ff5 7.34MB / 25.39MB 4.3s
#9 sha256:fdce0a3c2fd6842a6e21798d4bd43ac4003c6ea29718264961ac41fc95295ff5 11.53MB / 25.39MB 4.5s
#9 sha256:fdce0a3c2fd6842a6e21798d4bd43ac4003c6ea29718264961ac41fc95295ff5 13.63MB / 25.39MB 4.6s
#9 sha256:fdce0a3c2fd6842a6e21798d4bd43ac4003c6ea29718264961ac41fc95295ff5 17.83MB / 25.39MB 4.8s
#9 sha256:fdce0a3c2fd6842a6e21798d4bd43ac4003c6ea29718264961ac41fc95295ff5 19.92MB / 25.39MB 4.9s
#9 sha256:fdce0a3c2fd6842a6e21798d4bd43ac4003c6ea29718264961ac41fc95295ff5 24.12MB / 25.39MB 5.1s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 13.63MB / 29.31MB 5.2s
#9 sha256:fdce0a3c2fd6842a6e21798d4bd43ac4003c6ea29718264961ac41fc95295ff5 25.39MB / 25.39MB 5.1s done
#9 sha256:2b16274a403562af99768aa961be65d234de000b223b3c66e8cc1a8972d0f4b5 0B / 144.70MB 5.2s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 16.78MB / 29.31MB 5.4s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 6.29MB / 30.05MB 5.4s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 18.87MB / 29.31MB 5.9s
#9 sha256:2b16274a403562af99768aa961be65d234de000b223b3c66e8cc1a8972d0f4b5 7.34MB / 144.70MB 5.9s
#9 ...

#6 [final 1/4] RUN curl -O https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm
#6 sha256:497b4ae33e3cf375811f89e8ed7b1d7234490a26ba6a440f2483379375fcf143
#6 0.257   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#6 0.257                                  Dload  Upload   Total   Spent    Left  Speed
100 4071k  100 4071k    0     0   715k      0  0:00:05  0:00:05 --:--:--  966k
#6 6.025        package AWSLogsLambdaInsights-1.0-1.x86_64 is intended for a different architecture
#6 ERROR: executor failed running [/bin/sh -c curl -O https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm]: exit code: 1

#9 [build 1/7] FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim@sha256:fda5db18bc50cd935a424b08c0237f6bc9f9f9559f72e3076858454e0b59a4d5
#9 sha256:6eb9424c33071cb48aa448595f8b2e8c48ac986a9135ec43629c8db9f505b745
#9 CANCELED
------
 > [final 1/4] RUN curl -O https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm:
------
executor failed running [/bin/sh -c curl -O https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm]: exit code: 1

 ❌ Building assets failed: Error: Building Assets Failed: Error: Failed to build one or more assets. See the error messages above for more information.
    at buildAllStackAssets (/opt/homebrew/lib/node_modules/aws-cdk/lib/index.js:400:115268)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async CdkToolkit.deploy (/opt/homebrew/lib/node_modules/aws-cdk/lib/index.js:400:143766)
    at async exec4 (/opt/homebrew/lib/node_modules/aws-cdk/lib/index.js:455:51984)

Building Assets Failed: Error: Failed to build one or more assets. See the error messages above for more information.````



please fix or give instructions how to prevent this

@srcsakthivel
Copy link
Contributor Author

Took sometime to reproduce the issue. I have added in the requirement section and troubleshooting step.

@mavi888
Copy link
Contributor

mavi888 commented May 22, 2023

This is still failing when following the instructions.

cw-dashboard-lambda-metrics git:(srcsakthivel/main) ✗ cdk deploy

✨  Synthesis time: 9.32s

DotnetLambdaCloudwatchDashboardStack:  start: Building 98f861d5f5f78870913de01418525525ea5b88e4628825836a7e6550e762df53:current_account-current_region
#1 [internal] load build definition from Dockerfile
#1 sha256:83b199679e5b6e8d12e11023e0e45c37d6fc996c5fc7dd728ea4268f67b5163f
#1 transferring dockerfile: 950B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 sha256:648c7f39bf0d2dcd0eb69827f21ed1412c3c0695aa8dbd9c626652f489da9f3c
#2 transferring context: 2B done
#2 DONE 0.0s

#4 [internal] load metadata for public.ecr.aws/lambda/dotnet:6
#4 sha256:bc7065f21dee32ea7736ecb265d6ad759ce7f172f06256d480fe7154ca7f9074
#4 ...

#3 [internal] load metadata for mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim
#3 sha256:3958982a3cf434b4942b75846a4c6ed5d14bc6423ddd7d25d603df9ba4fd2d51
#3 DONE 0.3s

#4 [internal] load metadata for public.ecr.aws/lambda/dotnet:6
#4 sha256:bc7065f21dee32ea7736ecb265d6ad759ce7f172f06256d480fe7154ca7f9074
#4 DONE 0.7s

#5 [base 1/1] FROM public.ecr.aws/lambda/dotnet:6@sha256:820abb60697e4e6d3a8c62610a167148616c601cc9be6ba64626e857319e7eb9
#5 sha256:79996b429f899dd87208fde324b714639953df94bcfc51062dc41efc40927d59
#5 CACHED

#11 [internal] load build context
#11 sha256:7bb1ca1b4c60c007ce8c41e0ca78550b542e0ef67e49a284cd2d53243996ae37
#11 transferring context: 6.50kB 0.0s done
#11 DONE 0.0s

#9 [build 1/7] FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim@sha256:fda5db18bc50cd935a424b08c0237f6bc9f9f9559f72e3076858454e0b59a4d5
#9 sha256:6eb9424c33071cb48aa448595f8b2e8c48ac986a9135ec43629c8db9f505b745
#9 resolve mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim@sha256:fda5db18bc50cd935a424b08c0237f6bc9f9f9559f72e3076858454e0b59a4d5 0.0s done
#9 sha256:fda5db18bc50cd935a424b08c0237f6bc9f9f9559f72e3076858454e0b59a4d5 1.11kB / 1.11kB done
#9 sha256:5468fcfb7b1376bed09389195d4753bba08539e5cf0a0e33c39af7e318486f51 2.01kB / 2.01kB done
#9 sha256:a9ff2c65eb3a5852745e26674f4c9ba218b2ac584bf7dd99ee6001de4d290693 7.23kB / 7.23kB done
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 0B / 30.05MB 0.1s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 0B / 15.12MB 0.1s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 0B / 29.31MB 0.1s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 2.10MB / 30.05MB 1.3s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 1.05MB / 15.12MB 1.3s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 2.10MB / 15.12MB 1.5s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 3.15MB / 15.12MB 1.7s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 4.19MB / 30.05MB 2.2s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 2.10MB / 29.31MB 2.2s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 4.19MB / 15.12MB 2.3s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 5.24MB / 15.12MB 2.8s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 6.29MB / 30.05MB 3.3s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 6.29MB / 15.12MB 3.3s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 7.34MB / 15.12MB 3.7s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 8.39MB / 15.12MB 3.8s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 4.19MB / 29.31MB 3.8s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 8.39MB / 30.05MB 4.0s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 9.44MB / 15.12MB 4.2s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 10.49MB / 15.12MB 4.5s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 10.49MB / 30.05MB 4.7s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 11.53MB / 15.12MB 4.9s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 6.29MB / 29.31MB 4.9s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 12.58MB / 15.12MB 5.3s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 12.58MB / 30.05MB 5.5s
#9 CANCELED

#6 [final 1/4] RUN curl -O https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm
#6 sha256:3d4cb91a064609bd3c81f84ea5ee081265336c45c2fc795064ea676ed182b978
#6 0.230   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#6 0.230                                  Dload  Upload   Total   Spent    Left  Speed
100 4071k  100 4071k    0     0   786k      0  0:00:05  0:00:05 --:--:--  858k
#6 5.479        package AWSLogsLambdaInsights-1.0-1.x86_64 is intended for a different architecture
#6 ERROR: executor failed running [/bin/sh -c curl -O $INSIGHTSEXTENSION &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm]: exit code: 1
------
 > [final 1/4] RUN curl -O https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm:
------
executor failed running [/bin/sh -c curl -O $INSIGHTSEXTENSION &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm]: exit code: 1
DotnetLambdaCloudwatchDashboardStack:  fail: docker build --build-arg INSIGHTSEXTENSION=https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm --tag cdkasset-98f861d5f5f78870913de01418525525ea5b88e4628825836a7e6550e762df53 . exited with error code 1: #1 [internal] load build definition from Dockerfile
#1 sha256:83b199679e5b6e8d12e11023e0e45c37d6fc996c5fc7dd728ea4268f67b5163f
#1 transferring dockerfile: 950B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 sha256:648c7f39bf0d2dcd0eb69827f21ed1412c3c0695aa8dbd9c626652f489da9f3c
#2 transferring context: 2B done
#2 DONE 0.0s

#4 [internal] load metadata for public.ecr.aws/lambda/dotnet:6
#4 sha256:bc7065f21dee32ea7736ecb265d6ad759ce7f172f06256d480fe7154ca7f9074
#4 ...

#3 [internal] load metadata for mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim
#3 sha256:3958982a3cf434b4942b75846a4c6ed5d14bc6423ddd7d25d603df9ba4fd2d51
#3 DONE 0.3s

#4 [internal] load metadata for public.ecr.aws/lambda/dotnet:6
#4 sha256:bc7065f21dee32ea7736ecb265d6ad759ce7f172f06256d480fe7154ca7f9074
#4 DONE 0.7s

#5 [base 1/1] FROM public.ecr.aws/lambda/dotnet:6@sha256:820abb60697e4e6d3a8c62610a167148616c601cc9be6ba64626e857319e7eb9
#5 sha256:79996b429f899dd87208fde324b714639953df94bcfc51062dc41efc40927d59
#5 CACHED

#11 [internal] load build context
#11 sha256:7bb1ca1b4c60c007ce8c41e0ca78550b542e0ef67e49a284cd2d53243996ae37
#11 transferring context: 6.50kB 0.0s done
#11 DONE 0.0s

#9 [build 1/7] FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim@sha256:fda5db18bc50cd935a424b08c0237f6bc9f9f9559f72e3076858454e0b59a4d5
#9 sha256:6eb9424c33071cb48aa448595f8b2e8c48ac986a9135ec43629c8db9f505b745
#9 resolve mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim@sha256:fda5db18bc50cd935a424b08c0237f6bc9f9f9559f72e3076858454e0b59a4d5 0.0s done
#9 sha256:fda5db18bc50cd935a424b08c0237f6bc9f9f9559f72e3076858454e0b59a4d5 1.11kB / 1.11kB done
#9 sha256:5468fcfb7b1376bed09389195d4753bba08539e5cf0a0e33c39af7e318486f51 2.01kB / 2.01kB done
#9 sha256:a9ff2c65eb3a5852745e26674f4c9ba218b2ac584bf7dd99ee6001de4d290693 7.23kB / 7.23kB done
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 0B / 30.05MB 0.1s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 0B / 15.12MB 0.1s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 0B / 29.31MB 0.1s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 2.10MB / 30.05MB 1.3s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 1.05MB / 15.12MB 1.3s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 2.10MB / 15.12MB 1.5s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 3.15MB / 15.12MB 1.7s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 4.19MB / 30.05MB 2.2s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 2.10MB / 29.31MB 2.2s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 4.19MB / 15.12MB 2.3s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 5.24MB / 15.12MB 2.8s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 6.29MB / 30.05MB 3.3s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 6.29MB / 15.12MB 3.3s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 7.34MB / 15.12MB 3.7s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 8.39MB / 15.12MB 3.8s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 4.19MB / 29.31MB 3.8s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 8.39MB / 30.05MB 4.0s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 9.44MB / 15.12MB 4.2s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 10.49MB / 15.12MB 4.5s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 10.49MB / 30.05MB 4.7s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 11.53MB / 15.12MB 4.9s
#9 sha256:65fd06d6030b0a851846fb12313f34355edb6df82e1e20e6cccc183c6e2196e8 6.29MB / 29.31MB 4.9s
#9 sha256:b8bd4d0c9c3231cb70f0074a09e8af9dd4dccd14d4a5641c3173819ac467ce7c 12.58MB / 15.12MB 5.3s
#9 sha256:b5d25b35c1dbfa256bea3dd164b2048d6c7f8074a555213c493c36f07bf4c559 12.58MB / 30.05MB 5.5s
#9 CANCELED

#6 [final 1/4] RUN curl -O https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm
#6 sha256:3d4cb91a064609bd3c81f84ea5ee081265336c45c2fc795064ea676ed182b978
#6 0.230   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#6 0.230                                  Dload  Upload   Total   Spent    Left  Speed
100 4071k  100 4071k    0     0   786k      0  0:00:05  0:00:05 --:--:--  858k
#6 5.479        package AWSLogsLambdaInsights-1.0-1.x86_64 is intended for a different architecture
#6 ERROR: executor failed running [/bin/sh -c curl -O $INSIGHTSEXTENSION &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm]: exit code: 1
------
 > [final 1/4] RUN curl -O https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm:
------
executor failed running [/bin/sh -c curl -O $INSIGHTSEXTENSION &&     rpm -U lambda-insights-extension.rpm &&     rm -f lambda-insights-extension.rpm]: exit code: 1
DotnetLambdaCloudwatchDashboardStack:  start: Publishing 98f861d5f5f78870913de01418525525ea5b88e4628825836a7e6550e762df53:current_account-current_region
The push refers to repository [14482*****3.dkr.ecr.eu-west-1.amazonaws.com/cdk-hnb659fds-container-assets-14482*****3-eu-west-1]
tag does not exist: 14482*****3.dkr.ecr.eu-west-1.amazonaws.com/cdk-hnb659fds-container-assets-14482*****3-eu-west-1:98f861d5f5f78870913de01418525525ea5b88e4628825836a7e6550e762df53
DotnetLambdaCloudwatchDashboardStack:  fail: docker push 14482*****3.dkr.ecr.eu-west-1.amazonaws.com/cdk-hnb659fds-container-assets-14482*****3-eu-west-1:98f861d5f5f78870913de01418525525ea5b88e4628825836a7e6550e762df53 exited with error code 1: tag does not exist: 14482*****3.dkr.ecr.eu-west-1.amazonaws.com/cdk-hnb659fds-container-assets-14482*****3-eu-west-1:98f861d5f5f78870913de01418525525ea5b88e4628825836a7e6550e762df53
This deployment will make potentially sensitive changes according to your current security approval level (--require-approval broadening).
Please confirm you intend to make the following modifications:

IAM Statement Changes
┌───┬────────────────────────────────────────────────────┬────────┬────────────────┬──────────────────────────────┬───────────┐
│   │ Resource                                           │ Effect │ Action         │ Principal                    │ Condition │
├───┼────────────────────────────────────────────────────┼────────┼────────────────┼──────────────────────────────┼───────────┤
│ + │ ${container-image-lambda-function/ServiceRole.Arn} │ Allow  │ sts:AssumeRole │ Service:lambda.amazonaws.com │           │
└───┴────────────────────────────────────────────────────┴────────┴────────────────┴──────────────────────────────┴───────────┘
IAM Policy Changes
┌───┬────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐
│   │ Resource                                       │ Managed Policy ARN                                                             │
├───┼────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ + │ ${container-image-lambda-function/ServiceRole} │ arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole │
└───┴────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘
(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)

Do you wish to deploy these changes (y/n)? y
DotnetLambdaCloudwatchDashboardStack: deploying... [1/1]
DotnetLambdaCloudwatchDashboardStack: creating CloudFormation changeset...
1:30:17 PM | CREATE_FAILED        | AWS::Lambda::Function      | containerimagelambdafunction210E1AAC
Resource handler returned message: "Source image 14482*****3.dkr.ecr.eu-west-1.amazonaws.com/cdk-hnb659fds-container-assets-14482*****3-eu-
west-1:98f861d5f5f78870913de01418525525ea5b88e4628825836a7e6550e762df53 does not exist. Provide a valid source image. (Service: Lambda, Statu
s Code: 400, Request ID: 8a0d1fba-5e43-4edd-85b2-aadc2af39c36)" (RequestToken: 1410134b-b227-3a06-efe7-69bdd184e12c, HandlerErrorCode: Invali
dRequest)


 ❌  DotnetLambdaCloudwatchDashboardStack failed: Error: The stack named DotnetLambdaCloudwatchDashboardStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource handler returned message: "Source image 14482*****3.dkr.ecr.eu-west-1.amazonaws.com/cdk-hnb659fds-container-assets-14482*****3-eu-west-1:98f861d5f5f78870913de01418525525ea5b88e4628825836a7e6550e762df53 does not exist. Provide a valid source image. (Service: Lambda, Status Code: 400, Request ID: 8a0d1fba-5e43-4edd-85b2-aadc2af39c36)" (RequestToken: 1410134b-b227-3a06-efe7-69bdd184e12c, HandlerErrorCode: InvalidRequest)
    at FullCloudFormationDeployment.monitorDeployment (/opt/homebrew/lib/node_modules/aws-cdk/lib/index.js:397:10236)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack2 [as deployStack] (/opt/homebrew/lib/node_modules/aws-cdk/lib/index.js:400:149585)
    at async /opt/homebrew/lib/node_modules/aws-cdk/lib/index.js:400:135508

 ❌ Deployment failed: Error: The stack named DotnetLambdaCloudwatchDashboardStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource handler returned message: "Source image 14482*****3.dkr.ecr.eu-west-1.amazonaws.com/cdk-hnb659fds-container-assets-14482*****3-eu-west-1:98f861d5f5f78870913de01418525525ea5b88e4628825836a7e6550e762df53 does not exist. Provide a valid source image. (Service: Lambda, Status Code: 400, Request ID: 8a0d1fba-5e43-4edd-85b2-aadc2af39c36)" (RequestToken: 1410134b-b227-3a06-efe7-69bdd184e12c, HandlerErrorCode: InvalidRequest)
    at FullCloudFormationDeployment.monitorDeployment (/opt/homebrew/lib/node_modules/aws-cdk/lib/index.js:397:10236)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack2 [as deployStack] (/opt/homebrew/lib/node_modules/aws-cdk/lib/index.js:400:149585)
    at async /opt/homebrew/lib/node_modules/aws-cdk/lib/index.js:400:135508

The stack named DotnetLambdaCloudwatchDashboardStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource handler returned message: "Source image 14482*****3.dkr.ecr.eu-west-1.amazonaws.com/cdk-hnb659fds-container-assets-14482*****3-eu-west-1:98f861d5f5f78870913de01418525525ea5b88e4628825836a7e6550e762df53 does not exist. Provide a valid source image. (Service: Lambda, Status Code: 400, Request ID: 8a0d1fba-5e43-4edd-85b2-aadc2af39c36)" (RequestToken: 1410134b-b227-3a06-efe7-69bdd184e12c, HandlerErrorCode: InvalidRequest)

````

@srcsakthivel
Copy link
Contributor Author

I have explicitly called out the OS Version in requirement.

Please let me know if that looks good. Also, next if you ran into similar issue, please share the docker info as well. Thanks.

@mavi888
Copy link
Contributor

mavi888 commented Jun 5, 2023

Does this only works on a Architecture: x86_64? That might be the reason why it fails in my side. If that is the case, can you make this PR more generic?

@srcsakthivel
Copy link
Contributor Author

I guess it is because of the Package - AWSLogsLambdaInsights,

$ rpm -qi AWSLogsLambdaInsights-1.0-1
Name : AWSLogsLambdaInsights
Version : 1.0
Release : 1
Architecture: x86_64
Install Date: Tue 06 Jun 2023 06:25:06 PM UTC
Group : Unspecified
Size : 10871845
License : Copyright Amazon, Inc.
Signature : (none)
Source RPM : AWSLogsLambdaInsights-1.0-1.src.rpm
Build Date : Tue 30 May 2023 11:55:03 AM UTC
Build Host : e02d03e374dd
Relocations : (not relocatable)
URL : https://code.amazon.com/packages/AWSLogsLambdaInsights
Summary : Package to test the RPM transform in the BuildArtifactTransformService.
Description :
Package to test the RPM transform in the BuildArtifactTransformService.

Other details: awsdocs/amazon-cloudwatch-user-guide#97

@srcsakthivel
Copy link
Contributor Author

@mavi888 - just following up to see if you have any updates.

@jbesw
Copy link
Contributor

jbesw commented Jul 3, 2023

Due to PTO, we will pick this up for review in about 2 weeks. Sorry for the delay.

@mavi888
Copy link
Contributor

mavi888 commented Jul 18, 2023

The layer is also available for ARN: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-Getting-Started-docker.html#Lambda-Insights-Getting-Started-docker-ARM64

Can you make it more generic? So everybody can deploy it?

@srcsakthivel
Copy link
Contributor Author

@mavi888 - I have updated the code with variables. Updated the Readme.md as well for the ARM.

@mavi888
Copy link
Contributor

mavi888 commented Jul 31, 2023

Do you also need to add instructions to the readme on how to work with these variables?

@srcsakthivel
Copy link
Contributor Author

I have added those.

@mavi888
Copy link
Contributor

mavi888 commented Aug 7, 2023

Hello, I tested this and I cannot get the dashboard to show metrics.
There are no errors in deployments and I'm using the ARM64 configuration.

Screenshot 2023-08-07 at 10 17 38

@jbesw
Copy link
Contributor

jbesw commented Aug 24, 2023

This submission is too complex for patterns. Once the code is working, I would recommend resubmitting to the Serverless Land Repos collection: https://serverlessland.com/repos.

@jbesw jbesw closed this Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants