s3_bucket_notification
Creates, updates or deletes S3 Bucket notifications targeting Lambda functions, SNS or SQS
Collection: community.aws
Full Name: community.aws.s3_bucket_notification
Synopsis
Creates, updates or deletes S3 Bucket notifications targeting Lambda functions, SNS or SQS
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| access_key | str | |||
| aws_ca_bundle | path | |||
| aws_config | dict | |||
| bucket_name | str | yes | ||
| debug_botocore_endpoint_logs | bool | false | ||
| endpoint_url | str | |||
| event_name | str | yes | ||
| events | list | [] | ||
| lambda_alias | str | |||
| lambda_function_arn | str | |||
| lambda_version | int | 0 | ||
| prefix | str | |||
| profile | str | |||
| queue_arn | str | |||
| region | str | |||
| secret_key | str | |||
| session_token | str | |||
| state | str | present | ||
| suffix | str | |||
| topic_arn | str | |||
| validate_certs | bool | true |
Example
yaml
# Examples adding notification target configs to a S3 bucket
- name: Setup bucket event notification to a Lambda function
community.aws.s3_bucket_notification:
state: present
event_name: on_file_add_or_remove
bucket_name: test-bucket
lambda_function_arn: arn:aws:lambda:us-east-2:123456789012:function:test-lambda
events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
prefix: images/
suffix: .jpg
- name: Setup bucket event notification to SQS
community.aws.s3_bucket_notification:
state: present
event_name: on_file_add_or_remove
bucket_name: test-bucket
queue_arn: arn:aws:sqs:us-east-2:123456789012:test-queue
events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
prefix: images/
suffix: .jpg
# Example removing an event notification
- name: Remove event notification
community.aws.s3_bucket_notification:
state: absent
event_name: on_file_add_or_remove
bucket_name: test-bucket