Drew
03/22/2021, 7:55 PM// Datadog's AWS CDK macro:
from aws_cdk import core
class CdkStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
self.add_transform("DatadogCfnMacro")
mapping = core.CfnMapping(self, "Datadog",
mapping={
"Parameters": {
"enableDDTracing": true,
"flushMetricsToLogs": true,
"stackName": self.stackName,
"forwarderArn": "arn:aws:lambda:<REGION>:<ACCOUNT-ID>:function:datadog-forwarder",
"service": "my-cdk-app",
[...]
}
})
Frank
Drew
03/22/2021, 8:00 PMFrank
Drew
03/22/2021, 8:03 PMDrew
03/22/2021, 8:03 PMDennis Dang
03/22/2021, 8:03 PMFrank
Drew
03/22/2021, 8:05 PMFrank
export default class MyStack extends sst.Stack {
constructor(scope, id, props) {
super(scope, id, props);
this.addTransform("DatadogServerless");
new cdk.CfnMapping(this, "Datadog", {
mapping: {
Parameters: {
nodeLayerVersion: "<LAYER_VERSION>",
forwarderArn: "<FORWARDER_ARN>",
stackName: this.stackName,
service: "<SERVICE>", // Optional
env: "<ENV>", // Optional
// For additional parameters, see the Configuration section
},
},
});
}
}
Frank
addTransform
but it should work? let’s seeDrew
03/22/2021, 8:07 PMFrank
service
param, if you want to set that to the SST app name, you can do:
service: scope.name,
Drew
03/22/2021, 8:09 PMFrank
env
as the current stage:
env: this.stage
Dennis Dang
03/22/2021, 8:14 PMDrew
03/22/2021, 10:09 PMFrank
Dennis Dang
03/22/2021, 10:29 PMDmitry Pavluk
03/23/2021, 8:19 PM