Experimental
@aws-cdk/aws-iot-actions-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
S3PutObjectActionProps Struct
Configuration properties of an action for s3.
| Stability | Experimental |
|---|---|
| Source | lib/s3-put-object-action.ts |
Example
ts
const bucket = new s3.Bucket(this, 'MyBucket');
new iot.TopicRule(this, 'TopicRule', {
sql: iot.IotSql.fromStringAsVer20160323(
"SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'",
),
actions: [
new actions.S3PutObjectAction(bucket, {
key: '${year}/${month}/${day}/${topic(2)}',
}),
],
});
python
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)}"
)
]
)
java
Bucket bucket = new Bucket(this, "MyBucket");
TopicRule.Builder.create(this, "TopicRule")
.sql(IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'"))
.actions(List.of(
S3PutObjectAction.Builder.create(bucket)
.key("${year}/${month}/${day}/${topic(2)}")
.build()))
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.IoT.Actions.Alpha
var bucket = new Bucket(this, "MyBucket");
new TopicRule(this, "TopicRule", new TopicRuleProps {
Sql = IotSql.FromStringAsVer20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'"),
Actions = new [] {
new S3PutObjectAction(bucket, new S3PutObjectActionProps {
Key = "${year}/${month}/${day}/${topic(2)}"
}) }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkiotactionsalpha/v2
bucket := s3.NewBucket(this, jsii.String("MyBucket"))
iot.NewTopicRule(this, jsii.String("TopicRule"), &TopicRuleProps{
Sql: iot.IotSql_FromStringAsVer20160323(jsii.String("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'")),
Actions: []IAction{
actions.NewS3PutObjectAction(bucket, &S3PutObjectActionProps{
Key: jsii.String("${year}/${month}/${day}/${topic(2)}"),
}),
},
})
Properties
accessControloptionalBucketAccessControlaccess_controloptionalBucketAccessControlaccessControloptionalBucketAccessControlAccessControloptionalBucketAccessControlAccessControloptionalBucketAccessControl = None #The Amazon S3 canned ACL that controls access to the object identified by the object key.
keyoptionalstringkeyoptionalstrkeyoptionalStringKeyoptionalstringKeyoptional*string = '${topic()}/${timestamp()}' #The path to the file where the data is written.
Supports substitution templates.