

D'autres exemples de AWS SDK sont disponibles dans le référentiel [AWS Doc SDK Examples](https://github.com/awsdocs/aws-doc-sdk-examples) GitHub .

Les traductions sont fournies par des outils de traduction automatique. En cas de conflit entre le contenu d'une traduction et celui de la version originale en anglais, la version anglaise prévaudra.

# Exemples de signaux d'application utilisant AWS CLI
<a name="cli_2_application-signals_code_examples"></a>

Les exemples de code suivants vous montrent comment effectuer des actions et implémenter des scénarios courants à l' AWS Command Line Interface aide des signaux d'application.

Les *actions* sont des extraits de code de programmes plus larges et doivent être exécutées dans leur contexte. Alors que les actions vous indiquent comment appeler des fonctions de service individuelles, vous pouvez les voir en contexte dans leurs scénarios associés.

Chaque exemple inclut un lien vers le code source complet, où vous trouverez des instructions sur la configuration et l’exécution du code en contexte.

**Topics**
+ [Actions](#actions)

## Actions
<a name="actions"></a>

### `batch-get-service-level-objective-budget-report`
<a name="application-signals_BatchGetServiceLevelObjectiveBudgetReport_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`batch-get-service-level-objective-budget-report`.

**AWS CLI**  
**Pour extraire un ou plusieurs rapports budgétaires sur les objectifs de niveau de service (SLO)**  
L’exemple `batch-get-service-level-objective-budget-report` suivant extrait un ou plusieurs rapports budgétaires sur les objectifs de niveau de service (SLO).  

```
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"
```
Sortie :  

```
{
    "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": []
}
```
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [BatchGetServiceLevelObjectiveBudgetReport](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/batch-get-service-level-objective-budget-report.html)à la section *Référence des AWS CLI commandes*. 

### `create-service-level-objective`
<a name="application-signals_CreateServiceLevelObjective_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`create-service-level-objective`.

**AWS CLI**  
**Pour créer un objectif de niveau de service (SLO)**  
L’exemple `create-service-level-objective` suivant crée un objectif de niveau de service (SLO), qui peut vous aider à garantir que vos opérations métier critiques répondent aux attentes des clients.  

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

```
{
    "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"
}
```
Sortie :  

```
{
    "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
      }
    }
}
```
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [CreateServiceLevelObjective](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/create-service-level-objective.html)à la section *Référence des AWS CLI commandes*. 

### `delete-service-level-objective`
<a name="application-signals_DeleteServiceLevelObjective_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`delete-service-level-objective`.

**AWS CLI**  
**Pour supprimer l’objectif de niveau de service spécifié**  
L’exemple `delete-service-level-objective` suivant supprime l’objectif de niveau de service spécifié.  

```
aws application-signals delete-service-level-objective \
    --id "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName"
```
Cette commande ne produit aucune sortie.  
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [DeleteServiceLevelObjective](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/delete-service-level-objective.html)à la section *Référence des AWS CLI commandes*. 

### `get-service-level-objective`
<a name="application-signals_GetServiceLevelObjective_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`get-service-level-objective`.

**AWS CLI**  
**Pour renvoyer les informations sur un SLO créé dans le compte**  
L’exemple `get-service-level-objective` suivant renvoie des informations sur un SLO créé dans le compte.  

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

```
{
    "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
        }
    }
}
```
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [GetServiceLevelObjective](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/get-service-level-objective.html)à la section *Référence des AWS CLI commandes*. 

### `get-service`
<a name="application-signals_GetService_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`get-service`.

**AWS CLI**  
**Pour renvoyer les informations sur un service découvert par la vigie applicative**  
L’exemple `get-service` suivant renvoie des informations sur un service découvert par Application Signals.  

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

```
{
    "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"
    }]
}
```
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [GetService](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/get-service.html)à la section *Référence des AWS CLI commandes*. 

### `list-service-dependencies`
<a name="application-signals_ListServiceDependencies_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`list-service-dependencies`.

**AWS CLI**  
**Pour renvoyer une liste des dépendances du service que vous spécifiez**  
L’exemple `list-service-dependencies` suivant renvoie une liste des dépendances du service que vous spécifiez.  

```
aws application-signals list-service-dependencies \
    --start-time 1732021200 \
    --end-time 1732107600 \
    --key-attributes Environment=api-gateway:prod, Name=PetAdoptionStatusUpdater,Type=Service
```
Sortie :  

```
{
    "ServiceDependencies": [{
        "OperationName": "PUT /prod",
        "DependencyKeyAttributes": {
            "Environment": "lambda:default",
            "Name": "Services-name",
            "Type": "Service"
        },
        "DependencyOperationName": "Invoke",
        "MetricReferences": [{
            "Namespace": "ApplicationSignals",
            "MetricType": "LATENCY",
            "Dimensions": [{
                "Name": "Environment",
                "Value": "api-gateway:prod"
            }, {
                "Name": "Operation",
                "Value": "PUT /prod"
            }, {
                "Name": "RemoteEnvironment",
                "Value": "lambda:default"
            }, {
                "Name": "RemoteOperation",
                "Value": "Invoke"
            }, {
                "Name": "RemoteService",
                "Value": "Services-name"
            }, {
                "Name": "Service",
                "Value": "PetAdoptionStatusUpdater"
            }],
            "MetricName": "Latency"
        }, {
            "Namespace": "ApplicationSignals",
            "MetricType": "FAULT",
            "Dimensions": [{
                "Name": "Environment",
                "Value": "api-gateway:prod"
            }, {
                "Name": "Operation",
                "Value": "PUT /prod"
            }, {
                "Name": "RemoteEnvironment",
                "Value": "lambda:default"
            }, {
                "Name": "RemoteOperation",
                "Value": "Invoke"
            }, {
                "Name": "RemoteService",
                "Value": "Services-name"
            }, {
                "Name": "Service",
                "Value": "PetAdoptionStatusUpdater"
            }],
            "MetricName": "Fault"
        }, {
            "Namespace": "ApplicationSignals",
            "MetricType": "ERROR",
            "Dimensions": [{
                "Name": "Environment",
                "Value": "api-gateway:prod"
            }, {
                "Name": "Operation",
                "Value": "PUT /prod"
            }, {
                "Name": "RemoteEnvironment",
                "Value": "lambda:default"
            }, {
                "Name": "RemoteOperation",
                "Value": "Invoke"
            }, {
                "Name": "RemoteService",
                "Value": "Services-name"
            }, {
                "Name": "Service",
                "Value": "PetAdoptionStatusUpdater"
            }],
            "MetricName": "Error"
        }]
    }],
    "StartTime": "2024-11-19T13:00:00+00:00",
    "EndTime": "2024-11-20T13:00:01+00:00"
}
```
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [ListServiceDependencies](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/list-service-dependencies.html)à la section *Référence des AWS CLI commandes*. 

### `list-service-dependents`
<a name="application-signals_ListServiceDependents_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`list-service-dependents`.

**AWS CLI**  
**Pour renvoyer la liste des dépendances qui ont invoqué le service spécifié pendant la période spécifiée**  
L’exemple `list-service-dependents` suivant renvoie la liste des dépendances qui ont invoqué le service spécifié pendant la période spécifiée.  

```
aws application-signals list-service-dependents \
    --start-time 1732021200 \
    --end-time 1732107600 \
    --key-attributes Environment=generic:default,Name=PetSite,Type=Service
```
Sortie :  

```
{
    "ServiceDependents": [{
        "OperationName": "",
        "DependentKeyAttributes": {
            "Identifier": "pet-api-canary-hao",
            "ResourceType": "AWS::Synthetics::Canary",
            "Type": "AWS::Resource"
        },
        "DependentOperationName": "",
        "MetricReferences": []
    }, {
        "OperationName": "",
        "DependentKeyAttributes": {
            "Identifier": "PetSite",
            "ResourceType": "AWS::Synthetics::Canary",
            "Type": "AWS::Resource"
        },
        "DependentOperationName": "",
        "MetricReferences": []
    }],
    "StartTime": "2024-12-24T05:00:00+00:00",
    "EndTime": "2024-12-25T06:00:01+00:00"
}
```
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [ListServiceDependents](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/list-service-dependents.html)à la section *Référence des AWS CLI commandes*. 

### `list-service-level-objectives`
<a name="application-signals_ListServiceLevelObjectives_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`list-service-level-objectives`.

**AWS CLI**  
**Pour renvoyer une liste des personnes SLOs créées dans ce compte.**  
L'`list-service-level-objectives`exemple suivant renvoie une liste des comptes SLOs créés dans ce compte.  

```
aws application-signals list-service-level-objectives
```
Sortie :  

```
{
    "SloSummaries": [{
        "Arn": "arn:aws:application-signals:us-east-1:123456789101:slo/test",
        "Name": "test",
        "CreatedTime": "2024-12-24T22:01:21.116000+05:30"
    }]
}
```
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [ListServiceLevelObjectives](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/list-service-level-objectives.html)à la section *Référence des AWS CLI commandes*. 

### `list-service-operations`
<a name="application-signals_ListServiceOperations_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`list-service-operations`.

**AWS CLI**  
**Pour renvoyer une liste des opérations de ce service qui ont été découvertes par la vigie applicative**  
L’exemple `list-service-operations` suivant renvoie une liste des opérations de ce service qui ont été découvertes par Application Signals.  

```
aws application-signals list-service-operations \
    --start-time 1735017423 \
    --end-time 1735103823 \
    --key-attributes Environment=generic:default,Name=payforadoption,Type=Service
```
Sortie :  

```
{
    "ServiceOperations": [{
        "Name": "POST /api",
        "MetricReferences": [{
            "Namespace": "ApplicationSignals",
            "MetricType": "LATENCY",
            "Dimensions": [{
                "Name": "Environment",
                "Value": "generic:default"
            }, {
                "Name": "Operation",
                "Value": "POST /api"
            }, {
                "Name": "Service",
                "Value": "payforadoption"
            }],
            "MetricName": "Latency"
        }, {
            "Namespace": "ApplicationSignals",
            "MetricType": "FAULT",
            "Dimensions": [{
                "Name": "Environment",
                "Value": "generic:default"
            }, {
                "Name": "Operation",
                "Value": "POST /api"
            }, {
                "Name": "Service",
                "Value": "payforadoption"
            }],
            "MetricName": "Fault"
        }, {
            "Namespace": "ApplicationSignals",
            "MetricType": "ERROR",
            "Dimensions": [{
                "Name": "Environment",
                "Value": "generic:default"
            }, {
                "Name": "Operation",
                "Value": "POST /api"
            }, {
                "Name": "Service",
                "Value": "payforadoption"
            }],
            "MetricName": "Error"
        }]
    }],
    "StartTime": "2024-12-24T05:00:00+00:00",
    "EndTime": "2024-12-25T06:00:01+00:00"
}
```
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [ListServiceOperations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/list-service-operations.html)à la section *Référence des AWS CLI commandes*. 

### `list-services`
<a name="application-signals_ListServices_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`list-services`.

**AWS CLI**  
**Pour renvoyer une liste des services découverts par la vigie applicative**  
L’exemple `list-services` suivant renvoie une liste des services découverts par Application Signals.  

```
aws application-signals list-services \
    --start-time 1734918791 \
    --end-time 1734965591
```
Sortie :  

```
{
    "ServiceSummaries": [{
        "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"
        }]
    }],
    "StartTime": "2024-11-27T10:00:00+00:00",
    "EndTime": "2024-11-27T14:00:01+00:00"
}
```
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [ListServices](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/list-services.html)à la section *Référence des AWS CLI commandes*. 

### `list-tags-for-resource`
<a name="application-signals_ListTagsForResource_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`list-tags-for-resource`.

**AWS CLI**  
**Pour afficher les balises associées à une CloudWatch ressource**  
L'`list-tags-for-resource`exemple suivant affiche les balises associées à une CloudWatch ressource.  

```
aws application-signals list-tags-for-resource \
    --resource-arn "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName"
```
Sortie :  

```
{
    "Tags": [{
        "Key": "test",
        "Value": "value"
    }]
}
```
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/list-tags-for-resource.html)à la section *Référence des AWS CLI commandes*. 

### `start-discovery`
<a name="application-signals_StartDiscovery_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`start-discovery`.

**AWS CLI**  
**Pour permettre à ce compte Amazon Web Services d'utiliser les signaux CloudWatch d'application**  
L'`start-discovery`exemple suivant permet à ce compte Amazon Web Services d'utiliser les signaux d' CloudWatch application en créant le rôle *AWS ServiceRoleForCloudWatchApplicationSignals*lié au service.  

```
aws application-signals start-discovery
```
Cette commande ne produit aucune sortie.  
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [StartDiscovery](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/start-discovery.html)à la section *Référence des AWS CLI commandes*. 

### `tag-resource`
<a name="application-signals_TagResource_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`tag-resource`.

**AWS CLI**  
**Pour attribuer une ou plusieurs balises (paires clé-valeur) à la CloudWatch ressource spécifiée, telle qu'un objectif de niveau de service**  
L'`tag-resource`exemple suivant attribue une ou plusieurs balises (paires clé-valeur) à la CloudWatch ressource spécifiée, par exemple un objectif de niveau de service.  

```
aws application-signals tag-resource \
    --resource-arn "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName" \
    --tags '{"Key":"test","Value":"value"}'
```
Cette commande ne produit aucune sortie.  
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/tag-resource.html)à la section *Référence des AWS CLI commandes*. 

### `untag-resource`
<a name="application-signals_UntagResource_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`untag-resource`.

**AWS CLI**  
**Pour supprimer une ou plusieurs balises de la ressource spécifiée**  
L’exemple `untag-resource` suivant supprime une ou plusieurs balises de la ressource spécifiée.  

```
aws application-signals untag-resource \
    --resource-arn "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName" \
    --tag-keys "test"
```
Cette commande ne produit aucune sortie.  
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/untag-resource.html)à la section *Référence des AWS CLI commandes*. 

### `update-service-level-objective`
<a name="application-signals_UpdateServiceLevelObjective_cli_2_topic"></a>

L'exemple de code suivant montre comment utiliser`update-service-level-objective`.

**AWS CLI**  
**Pour mettre à jour un objectif de niveau de service (SLO)**  
L’exemple `update-service-level-objective` suivant met à jour un objectif de niveau de service (SLO) existant.  

```
aws application-signals update-service-level-objective \
--cli-input-json file://update-slo.json
```
Contenu de `update-slo.json` :  

```
{
    "id": "arn:aws:application-signals:us-east-1:123456789101:slo/SLOName",
    "goal": {
        "Interval": {
            "RollingInterval": {
                "DurationUnit": "DAY",
                "Duration": 7
            }
        },
        "AttainmentGoal": 90.0,
        "WarningThreshold": 50.0
    }
}
```
Sortie :  

```
{
    "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-27T08:51:38.278000+05:30",
        "Sli": {
            "SliMetric": {
                "MetricDataQueries": [{
                    "Id": "m1",
                    "MetricStat": {
                        "Metric": {
                            "Namespace": "AWS/EC2",
                            "MetricName": "CPUUtilization",
                            "Dimensions": [{
                                "Name": "InstanceId",
                                "Value": "i-00987654345222"
                            }]
                        },
                        "Period": 60,
                        "Stat": "Average"
                    },
                    "ReturnData": true
                }]
            },
            "MetricThreshold": 200.0,
            "ComparisonOperator": "LessThanOrEqualTo"
        },
        "EvaluationType": "PeriodBased",
        "Goal": {
            "Interval": {
                "RollingInterval": {
                    "DurationUnit": "DAY",
                    "Duration": 7
                }
            },
            "AttainmentGoal": 90.0,
            "WarningThreshold": 50.0
        }
    }
}
```
Pour plus d'informations, consultez [Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html) dans le *guide de CloudWatch l'utilisateur Amazon*.  
+  Pour plus de détails sur l'API, reportez-vous [UpdateServiceLevelObjective](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/application-signals/update-service-level-objective.html)à la section *Référence des AWS CLI commandes*. 