

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.

# Utilisation de `StartAutomationExecution` avec une CLI
<a name="ssm_example_ssm_StartAutomationExecution_section"></a>

Les exemples de code suivants illustrent comment utiliser `StartAutomationExecution`.

------
#### [ CLI ]

**AWS CLI**  
**Exemple 1 : pour exécuter un document d’automatisation**  
L’exemple `start-automation-execution` suivant exécute un document d’automatisation.  

```
aws ssm start-automation-execution \
    --document-name "AWS-UpdateLinuxAmi" \
    --parameters "AutomationAssumeRole=arn:aws:iam::123456789012:role/SSMAutomationRole,SourceAmiId=ami-EXAMPLE,IamInstanceProfileName=EC2InstanceRole"
```
Sortie :  

```
{
  "AutomationExecutionId": "4105a4fc-f944-11e6-9d32-0a1b2EXAMPLE"
}
```
Pour plus d’informations, consultez [Exécution manuelle d’un flux de travail d’automatisation](https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-working-executing-manually.html) dans le *Guide de l’utilisateur AWS Systems Manager*.  
**Exemple 2 : pour exécuter un document d’automatisation partagé**  
L’exemple `start-automation-execution` suivant exécute un document d’automatisation partagé.  

```
aws ssm start-automation-execution \
    --document-name "arn:aws:ssm:us-east-1:123456789012:document/ExampleDocument"
```
Sortie :  

```
{
  "AutomationExecutionId": "4105a4fc-f944-11e6-9d32-0a1b2EXAMPLE"
}
```
Pour plus d’informations, consultez [Utilisation de documents SSM partagés](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-using-shared.html) dans le *Guide de l’utilisateur AWS Systems Manager*.  
+  Pour plus de détails sur l'API, reportez-vous [StartAutomationExecution](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ssm/start-automation-execution.html)à la section *Référence des AWS CLI commandes*. 

------
#### [ PowerShell ]

**Outils pour PowerShell V4**  
**Exemple 1 : cet exemple exécute un document qui spécifie un rôle d’automatisation, un ID de source AMI et un rôle d’instance Amazon EC2.**  

```
Start-SSMAutomationExecution -DocumentName AWS-UpdateLinuxAmi -Parameter @{'AutomationAssumeRole'='arn:aws:iam::123456789012:role/SSMAutomationRole';'SourceAmiId'='ami-f173cc91';'InstanceIamRole'='EC2InstanceRole'}
```
**Sortie** :  

```
3a532a4f-0382-11e7-9df7-6f11185f6dd1
```
+  Pour plus de détails sur l'API, reportez-vous [StartAutomationExecution](https://docs.aws.amazon.com/powershell/v4/reference)à la section *Référence des Outils AWS pour PowerShell applets de commande (V4)*. 

**Outils pour PowerShell V5**  
**Exemple 1 : cet exemple exécute un document qui spécifie un rôle d’automatisation, un ID de source AMI et un rôle d’instance Amazon EC2.**  

```
Start-SSMAutomationExecution -DocumentName AWS-UpdateLinuxAmi -Parameter @{'AutomationAssumeRole'='arn:aws:iam::123456789012:role/SSMAutomationRole';'SourceAmiId'='ami-f173cc91';'InstanceIamRole'='EC2InstanceRole'}
```
**Sortie** :  

```
3a532a4f-0382-11e7-9df7-6f11185f6dd1
```
+  Pour plus de détails sur l'API, reportez-vous [StartAutomationExecution](https://docs.aws.amazon.com/powershell/v5/reference)à la section *Référence des Outils AWS pour PowerShell applets de commande (V5)*. 

------