DataDog / datadog-cloudformation-macro

CloudFormation Macros by Datadog
Apache License 2.0
14 stars 22 forks source link

CloudFormation Macro #1

Closed hannah-sun closed 4 years ago

hannah-sun commented 4 years ago

What does this PR do?

Creates a CloudFormation macro/transform for customers deploying lambda functions using SAM, CDK, or raw CloudFormation templates. The macro attaches the Datadog Lambda Layers for node.js and python functions by modifying the CloudFormation template.

Customers can also:

Motivation

We currently have the serverless plugin to help instrument customers' lambda functions, and we would like to do the same for customers using SAM/CDK/CloudFormation. Ticket at https://datadoghq.atlassian.net/browse/SLS-397

Testing Guidelines

Added unit tests, also deployed and tested the macro on sandbox account with sample lambdas deployed through SAM & CDK. (Will do additional testing for deploying through raw CloudFormation.)

Additional Notes

The macro logic is a lambda function itself, and is currently deployed through the serverless framework. Since this is for SAM/CDK/CloudFormation users, there will be a followup PR that adds other templates so customers don't have to use the serverless framework to deploy the macro resource on their AWS accounts.

tianchu commented 4 years ago

Just capturing some of the previously discussed items, not sure if you have already addressed them :)

  1. Ideally we provide the customer a CFN template like https://github.com/DataDog/cloudformation-template/blob/master/aws/datadog_policy_macro.yaml (except for the function is not inline) that deploys both the Macro definition and the underlying function
  2. Let's version the Macro like this https://github.com/DataDog/datadog-serverless-functions/blob/f7568f43efa343b9fe3c2c5da5791767d8c20d5d/aws/logs_monitoring/template.yaml#L7? We could automatically update the version number in the release script