S3PutObjectAction

class aws_cdk.aws_iot_actions.S3PutObjectAction(bucket, *, access_control=None, key=None, role=None)

Bases: object

(experimental) The action to write the data from an MQTT message to an Amazon S3 bucket.

Stability:

experimental

ExampleMetadata:

infused

Example:

bucket = s3.Bucket(self, "MyBucket")

iot.TopicRule(self, "TopicRule",
    sql=iot.IotSql.from_string_as_ver20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'"),
    actions=[
        actions.S3PutObjectAction(bucket,
            key="${year}/${month}/${day}/${topic(2)}"
        )
    ]
)
Parameters:
  • bucket (IBucket) – The Amazon S3 bucket to which to write data.

  • access_control (Optional[BucketAccessControl]) – (experimental) The Amazon S3 canned ACL that controls access to the object identified by the object key. Default: None

  • key (Optional[str]) – (experimental) The path to the file where the data is written. Supports substitution templates. Default: ‘${topic()}/${timestamp()}’

  • role (Optional[IRole]) – (experimental) The IAM role that allows access to AWS service. Default: a new role will be created

Stability:

experimental

Methods

bind(rule)

(experimental) Returns the topic rule action specification.

Parameters:

rule (ITopicRule) –

Stability:

experimental

Return type:

ActionConfig