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

adding CLI examples for App signals #9176

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
**To retrieve one or more service level objective (SLO) budget reports.**

The following ``batch-get-service-level-objective-budget-report`` example retrieves one or more service level objective (SLO) budget reports. ::

aws application-signals batch-get-service-level-objective-budget-report \
--timestamp 1735059869 \
--slo-ids "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName1" "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName2"

Output::

{
"Timestamp": "2024-12-24T22:34:29+05:30",
"Reports": [{
"Arn": "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName1",
"Name": "Your SLO Name",
"EvaluationType": "PeriodBased",
"BudgetStatus": "OK",
"Attainment": 100.0,
"TotalBudgetSeconds": 6048,
"BudgetSecondsRemaining": 6048,
"Sli": {
"SliMetric": {
"MetricDataQueries": [{
"Id": "m1",
"MetricStat": {
"Metric": {
"Namespace": "AWS/EC2",
"MetricName": "CPUUtilization",
"Dimensions": [{
"Name": "InstanceId",
"Value": "i-0e098765432522"
}]
},
"Period": 60,
"Stat": "Average"
},
"ReturnData": true
}]
},
"MetricThreshold": 200.0,
"ComparisonOperator": "LessThanOrEqualTo"
},
"Goal": {
"Interval": {
"RollingInterval": {
"DurationUnit": "DAY",
"Duration": 7
}
},
"AttainmentGoal": 99.0,
"WarningThreshold": 50.0
}
},
{
"Arn": "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName2",
"Name": "test",
"EvaluationType": "PeriodBased",
"BudgetStatus": "BREACHED",
"Attainment": 97.39583275,
"TotalBudgetSeconds": 86,
"BudgetSecondsRemaining": -2154,
"Sli": {
"SliMetric": {
"MetricDataQueries": [{
"Id": "cwMetric",
"MetricStat": {
"Metric": {
"Namespace": "AWS/EC2",
"MetricName": "CPUUtilization",
"Dimensions": [{
"Name": "InstanceId",
"Value": "i-0e12345678922"
}]
},
"Period": 300,
"Stat": "Average"
},
"ReturnData": true
}]
},
"MetricThreshold": 5.0,
"ComparisonOperator": "GreaterThan"
},
"Goal": {
"Interval": {
"RollingInterval": {
"DurationUnit": "DAY",
"Duration": 1
}
},
"AttainmentGoal": 99.9,
"WarningThreshold": 30.0
}
}
],
"Errors": []
}

For more information, see `<https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html>`__ in the *Amazon CloudWatch User Guide*.
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
**To create a service level objective (SLO)**

The following ``create-service-level-objective`` example creates a service level objective (SLO), which can help you ensure that your critical business operations are meeting customer expectations. ::

aws application-signals create-service-level-objective \
--name "SLOName" \
--description "Description of your SLO" \
--sli-config file://sli-config.json

The file ``sli-config`` is a JSON documnet in the current folder.

{
"SliMetricConfig": {
"MetricDataQueries": [
{
"Id": "m1",
"MetricStat": {
"Metric": {
"Namespace": "AWS/EC2",
"MetricName": "CPUUtilization",
"Dimensions": [
{
"Name": "InstanceId",
"Value": "i-0e5a1234561522"
}
]
},
"Period": 60,
"Stat": "Average"
},
"ReturnData": true
}
]
},
"MetricThreshold": 200,
"ComparisonOperator": "LessThanOrEqualTo"
}

Output::

{
"Slo": {
"Arn": "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName",
"Name": "SLOName",
"Description": "Description of your SLO",
"CreatedTime": "2024-12-27T08:16:09.032000+05:30",
"LastUpdatedTime": "2024-12-27T08:16:09.032000+05:30",
"Sli": {
"SliMetric": {
"MetricDataQueries": [
{
"Id": "m1",
"MetricStat": {
"Metric": {
"Namespace": "AWS/EC2",
"MetricName": "CPUUtilization",
"Dimensions": [
{
"Name": "InstanceId",
"Value": "i-0e59876543234522"
}
]
},
"Period": 60,
"Stat": "Average"
},
"ReturnData": true
}
]
},
"MetricThreshold": 200.0,
"ComparisonOperator": "LessThanOrEqualTo"
},
"EvaluationType": "PeriodBased",
"Goal": {
"Interval": {
"RollingInterval": {
"DurationUnit": "DAY",
"Duration": 7
}
},
"AttainmentGoal": 99.0,
"WarningThreshold": 50.0
}
}
}

For more information, see `<https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html>`__ in the *Amazon CloudWatch User Guide*.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
**To delete the specified service level objective.**

The following ``delete-service-level-objective`` example deletes the specified service level objective. ::

aws application-signals delete-service-level-objective \
--id "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName"

Output::

This command produces no output.

For more information, see `<https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html>`__ in the *Amazon CloudWatch User Guide*.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
**To return information about one SLO created in the account**

The following ``get-service-level-objective`` example returns information about one SLO created in the account. ::

aws application-signals get-service-level-objective \
--id "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName"

Output::

{
"Slo": {
"Arn": "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName",
"Name": "SLOName",
"Description": "Description of your SLO",
"CreatedTime": "2024-12-24T22:19:18.624000+05:30",
"LastUpdatedTime": "2024-12-24T22:19:55.280000+05:30",
"Sli": {
"SliMetric": {
"MetricDataQueries": [{
"Id": "m1",
"MetricStat": {
"Metric": {
"Namespace": "AWS/EC2",
"MetricName": "CPUUtilization",
"Dimensions": [{
"Name": "InstanceId",
"Value": "i-0e0987654321522"
}]
},
"Period": 60,
"Stat": "Average"
},
"ReturnData": true
}]
},
"MetricThreshold": 200.0,
"ComparisonOperator": "LessThanOrEqualTo"
},
"EvaluationType": "PeriodBased",
"Goal": {
"Interval": {
"RollingInterval": {
"DurationUnit": "DAY",
"Duration": 7
}
},
"AttainmentGoal": 99.0,
"WarningThreshold": 50.0
}
}
}

For more information, see `<https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html>`__ in the *Amazon CloudWatch User Guide*.
72 changes: 72 additions & 0 deletions awscli/examples/application-signals/get-service.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
**To return information about a service discovered by Application Signals**

The following ``get-service`` example returns information about a service discovered by Application Signals. ::

aws application-signals get-service \
--start-time 1732704000 \
--end-time 1732714500 \
--key-attributes Environment=lambda:default,Name=hello-world-python,Type=Service

Output::

{
"Service": {
"KeyAttributes": {
"Environment": "lambda:default",
"Name": "hello-world-python",
"Type": "Service"
},
"AttributeMaps": [{
"Lambda.Function.Name": "hello-world-python",
"PlatformType": "AWS::Lambda"
}],
"MetricReferences": [{
"Namespace": "ApplicationSignals",
"MetricType": "LATENCY",
"Dimensions": [{
"Name": "Environment",
"Value": "lambda:default"
}, {
"Name": "Service",
"Value": "hello-world-python"
}],
"MetricName": "Latency"
}, {
"Namespace": "ApplicationSignals",
"MetricType": "FAULT",
"Dimensions": [{
"Name": "Environment",
"Value": "lambda:default"
}, {
"Name": "Service",
"Value": "hello-world-python"
}],
"MetricName": "Fault"
}, {
"Namespace": "ApplicationSignals",
"MetricType": "ERROR",
"Dimensions": [{
"Name": "Environment",
"Value": "lambda:default"
}, {
"Name": "Service",
"Value": "hello-world-python"
}],
"MetricName": "Error"
}],
"LogGroupReferences": [{
"Identifier": "/aws/lambda/hello-world-python",
"ResourceType": "AWS::Logs::LogGroup",
"Type": "AWS::Resource"
}]
},
"StartTime": "2024-11-27T10:00:00+00:00",
"EndTime": "2024-11-27T14:00:01+00:00",
"LogGroupReferences": [{
"Identifier": "/aws/lambda/hello-world-python",
"ResourceType": "AWS::Logs::LogGroup",
"Type": "AWS::Resource"
}]
}

For more information, see `<https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html>`__ in the *Amazon CloudWatch User Guide*.
Loading