https://pulumi.com logo
s

steep-toddler-98503

06/06/2019, 11:32 PM
Hello guys, i am working with pulumi using JavaScript and AWS, i want to create a CloudWatch Dashboard and i need to specify a dashboarbody that is a JSON, i want to create a dashboard to monitoring the CPU of my auto scaling group, and i must to specify the name of auto scaling but when i get the name of the ASG already created pulumi return me a promise.
f

full-dress-10026

06/06/2019, 11:34 PM
I suggest using
awsx.cloudwatch.Dashboard
. It accepts Outputs in its args.
s

steep-toddler-98503

06/11/2019, 3:34 PM
Hello again, i solved my trouble, i used the Pulumi Apply but into the function, i created the aws resource and used stringify, share my code
function CreateDashboard(ParametersDashboard) { ParametersDashboard.ASG_Name.apply(name => { const body = { widgets: [ { type: "metric", x: 0, y: 0, width: 12, height: 6, properties: { metrics: [ [ "AWS/EC2", "CPUUtilization", "AutoScalingGroupName", name ] ], period: 300, stat: "Average", region: "us-east-1", title: "CPU-Utilization-Auto-Scaling" } } ] } const main = new aws.cloudwatch.Dashboard("main", { dashboardBody: JSON.stringify(body), dashboardName: "Dashboard" }); }) }