Complete the code to create a CloudWatch dashboard with a specified name.
aws cloudwatch put-dashboard --dashboard-name [1] --dashboard-body file://dashboard.jsonThe --dashboard-name parameter specifies the name of the dashboard to create or update. Here, Dashboard1 is used as the example name.
Complete the code to specify the dashboard body JSON file for the CloudWatch dashboard.
aws cloudwatch put-dashboard --dashboard-name Dashboard1 --dashboard-body [1]file:// prefix when specifying a file.The --dashboard-body parameter expects a JSON string or a file reference. Using file://dashboard.json tells AWS CLI to read the JSON content from the file.
Fix the error in the dashboard JSON snippet by completing the missing widget type.
{
"widgets": [
{
"type": "[1]",
"x": 0,
"y": 0,
"width": 6,
"height": 6,
"properties": {
"metrics": [["AWS/EC2", "CPUUtilization", "InstanceId", "i-1234567890abcdef0"]],
"period": 300,
"stat": "Average",
"region": "us-east-1",
"title": "EC2 CPU"
}
}
]
}The widget type for displaying metrics in a CloudWatch dashboard is metric. This tells CloudWatch to show a graph of the specified metric.
Fill both blanks to complete the widget properties for a CloudWatch dashboard showing average CPU utilization.
{
"widgets": [
{
"type": "metric",
"x": 0,
"y": 0,
"width": [1],
"height": [2],
"properties": {
"metrics": [["AWS/EC2", "CPUUtilization"]],
"period": 300,
"stat": "Average",
"region": "us-west-2",
"title": "CPU Usage"
}
}
]
}The widget width and height define its size on the dashboard grid. Common sizes are 6 or 12 units wide and tall. Here, width is 6 and height is 12 for a taller graph.
Fill all three blanks to complete the JSON snippet for a CloudWatch dashboard widget showing average network in bytes for an EC2 instance.
{
"widgets": [
{
"type": "[1]",
"x": 0,
"y": 0,
"width": 6,
"height": 6,
"properties": {
"metrics": [["AWS/EC2", "[2]", "InstanceId", "[3]"]],
"period": 300,
"stat": "Average",
"region": "us-east-2",
"title": "Network In"
}
}
]
}The widget type is metric to show a graph. The metric name is NetworkIn for incoming network bytes. The instance ID is a sample EC2 instance ID.