CreateServiceLevelObjective
Creates a service level objective (SLO), which can help you ensure that your critical business operations are meeting customer expectations. Use SLOs to set and track specific target levels for the reliability and availability of your applications and services. SLOs use service level indicators (SLIs) to calculate whether the application is performing at the level that you want.
Create an SLO to set a target for a service or operation’s availability or latency. CloudWatch measures this target frequently you can find whether it has been breached.
When you create an SLO, you set an attainment goal for it. An attainment goal is the ratio of good periods that meet the threshold requirements to the total periods within the interval. For example, an attainment goal of 99.9% means that within your interval, you are targeting 99.9% of the periods to be in healthy state.
After you have created an SLO, you can retrieve error budget reports for it. An error budget is the number of periods or amount of time that your service can accumulate during an interval before your overall SLO budget health is breached and the SLO is considered to be unmet. for example, an SLO with a threshold that 99.95% of requests must be completed under 2000ms every month translates to an error budget of 21.9 minutes of downtime per month.
When you call this operation, Application Signals creates the AWSServiceRoleForCloudWatchApplicationSignals service-linked role, if it doesn't already exist in your account. This service- linked role has the following permissions:
-
xray:GetServiceGraph
-
logs:StartQuery
-
logs:GetQueryResults
-
cloudwatch:GetMetricData
-
cloudwatch:ListMetrics
-
tag:GetResources
-
autoscaling:DescribeAutoScalingGroups
You can easily set SLO targets for your applications that are discovered by Application Signals, using critical metrics such as latency and availability. You can also set SLOs against any CloudWatch metric or math expression that produces a time series.
For more information about SLOs, see Service level objectives (SLOs).
Request Syntax
POST /slo HTTP/1.1
Content-type: application/json
{
"Description": "string
",
"Goal": {
"AttainmentGoal": number
,
"Interval": { ... },
"WarningThreshold": number
},
"Name": "string
",
"SliConfig": {
"ComparisonOperator": "string
",
"MetricThreshold": number
,
"SliMetricConfig": {
"KeyAttributes": {
"string
" : "string
"
},
"MetricDataQueries": [
{
"AccountId": "string
",
"Expression": "string
",
"Id": "string
",
"Label": "string
",
"MetricStat": {
"Metric": {
"Dimensions": [
{
"Name": "string
",
"Value": "string
"
}
],
"MetricName": "string
",
"Namespace": "string
"
},
"Period": number
,
"Stat": "string
",
"Unit": "string
"
},
"Period": number
,
"ReturnData": boolean
}
],
"MetricType": "string
",
"OperationName": "string
",
"PeriodSeconds": number
,
"Statistic": "string
"
}
},
"Tags": [
{
"Key": "string
",
"Value": "string
"
}
]
}
URI Request Parameters
The request does not use any URI parameters.
Request Body
The request accepts the following data in JSON format.
- Description
-
An optional description for this SLO.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 1024.
Required: No
- Goal
-
A structure that contains the attributes that determine the goal of the SLO. This includes the time period for evaluation and the attainment threshold.
Type: Goal object
Required: No
- Name
-
A name for this SLO.
Type: String
Pattern:
[0-9A-Za-z][-._0-9A-Za-z ]{0,126}[0-9A-Za-z]
Required: Yes
- SliConfig
-
A structure that contains information about what service and what performance metric that this SLO will monitor.
Type: ServiceLevelIndicatorConfig object
Required: Yes
- Tags
-
A list of key-value pairs to associate with the SLO. You can associate as many as 50 tags with an SLO. To be able to associate tags with the SLO when you create the SLO, you must have the
cloudwatch:TagResource
permission.Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.
Type: Array of Tag objects
Array Members: Minimum number of 0 items. Maximum number of 200 items.
Required: No
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"Slo": {
"Arn": "string",
"CreatedTime": number,
"Description": "string",
"Goal": {
"AttainmentGoal": number,
"Interval": { ... },
"WarningThreshold": number
},
"LastUpdatedTime": number,
"Name": "string",
"Sli": {
"ComparisonOperator": "string",
"MetricThreshold": number,
"SliMetric": {
"KeyAttributes": {
"string" : "string"
},
"MetricDataQueries": [
{
"AccountId": "string",
"Expression": "string",
"Id": "string",
"Label": "string",
"MetricStat": {
"Metric": {
"Dimensions": [
{
"Name": "string",
"Value": "string"
}
],
"MetricName": "string",
"Namespace": "string"
},
"Period": number,
"Stat": "string",
"Unit": "string"
},
"Period": number,
"ReturnData": boolean
}
],
"MetricType": "string",
"OperationName": "string"
}
}
}
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- Slo
-
A structure that contains information about the SLO that you just created.
Type: ServiceLevelObjective object
Errors
For information about the errors that are common to all actions, see Common Errors.
- AccessDeniedException
-
You don't have sufficient permissions to perform this action.
HTTP Status Code: 403
- ConflictException
-
This operation attempted to create a resource that already exists.
HTTP Status Code: 409
- ServiceQuotaExceededException
-
This request exceeds a service quota.
HTTP Status Code: 402
- ThrottlingException
-
The request was throttled because of quota limits.
HTTP Status Code: 429
- ValidationException
-
The resource is not valid.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: