

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.

# S3
<a name="sam-property-function-s3"></a>

L'objet décrivant un type de source d'événement `S3`.

## Syntaxe
<a name="sam-property-function-s3-syntax"></a>

Pour déclarer cette entité dans votre modèle AWS Serverless Application Model (AWS SAM), utilisez la syntaxe suivante.

### YAML
<a name="sam-property-function-s3-syntax.yaml"></a>

```
  [Bucket](#sam-function-s3-bucket): String
  [Events](#sam-function-s3-events): String | List
  [Filter](#sam-function-s3-filter): [NotificationFilter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfiguration-config-filter.html)
```

## Propriétés
<a name="sam-property-function-s3-properties"></a>

 `Bucket`   <a name="sam-function-s3-bucket"></a>
Nom du compartiment S3. Ce compartiment doit exister dans le même modèle.  
*Type* : chaîne  
*Obligatoire* : oui  
*CloudFormation compatibilité* : cette propriété est similaire à celle `[BucketName](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-name)` d'une `AWS::S3::Bucket` ressource. Ce champ est obligatoire dans SAM. Ce champ accepte uniquement une référence au compartiment S3 créé dans ce modèle

 `Events`   <a name="sam-function-s3-events"></a>
L'événement de compartiment Amazon S3 pour lequel appeler la fonction Lambda. Consultez [Types d'événements pris en charge par Amazon S3](https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#supported-notification-event-types) pour obtenir la liste des valeurs valides.  
*Type* : chaîne \$1 liste  
*Obligatoire* : oui  
*CloudFormation compatibilité* : cette propriété est transmise directement à la `[Event](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfig-lambdaconfig.html#cfn-s3-bucket-notificationconfig-lambdaconfig-event)` propriété du type de `AWS::S3::Bucket` `LambdaConfiguration` données.

 `Filter`   <a name="sam-function-s3-filter"></a>
Les règles de filtrage qui déterminent quels objets Amazon S3 appellent la fonction Lambda. Pour en savoir plus sur le filtrage par nom de clé Amazon S3, consultez [Configuration des notifications d'événement Amazon S3](https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) dans le *Guide de l'utilisateur Amazon Simple Storage Service*.  
*Type :* [NotificationFilter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfiguration-config-filter.html)  
*Obligatoire* : non  
*CloudFormation compatibilité* : cette propriété est transmise directement à la `[Filter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-notificationconfiguration-config-filter.html)` propriété du type de `AWS::S3::Bucket` `LambdaConfiguration` données.

## Exemples
<a name="sam-property-function-s3--examples"></a>

### Événement S3
<a name="sam-property-function-s3--examples--s3-event"></a>

Exemple d'événement S3.

#### YAML
<a name="sam-property-function-s3--examples--s3-event--yaml"></a>

```
Events:
  S3Event:
    Type: S3
    Properties:
      Bucket:
        Ref: ImagesBucket     # This must be the name of an S3 bucket declared in the same template file
      Events: s3:ObjectCreated:*
      Filter:
        S3Key:
          Rules:
          - Name: prefix      # or "suffix"
            Value: value      # The value to search for in the S3 object key names
```