Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```ts
- "use strict";
- const pulumi = require("@pulumi/pulumi");
- const aws = require("@pulumi/aws");
- const awsx = require("@pulumi/awsx");
- //* Create Kinesis stream for ingestion
- const ingestStream = new aws.kinesis.Stream("ingestAssets", {
- shardCount: 1,
- retentionPeriod: 72
- });
- //* Create IoT Rule to push into Kinesis stream
- const iotRole = new aws.iam.Role("iotRole", {
- assumeRolePolicy: JSON.stringify({
- Version: "2012-10-17",
- Statement: [
- {
- Effect: "Allow",
- Principal: {
- Service: "iot.amazonaws.com"
- },
- Action: "sts:AssumeRole"
- }
- ]
- })
- });
- const iotRolePolicy = new aws.iam.RolePolicy("iotRolePolicy", {
- policy: pulumi.interpolate`{
- "Version": "2012-10-17",
- "Statement": [
- {
- "Effect": "Allow",
- "Action": [
- "kinesis:*"
- ],
- "Resource": "${ingestStream.arn}"
- }
- ]
- }`,
- role: iotRole.id
- });
- const iotRule = new aws.iot.TopicRule("iotTrigger", {
- description: "Pass from IoT Core to Asset Tracking",
- name: "iotAssetIngest",
- enabled: true,
- kinesis: {
- partitionKey: "id",
- roleArn: iotRole.arn,
- streamName: ingestStream.name
- },
- sql: "SELECT * FROM 'topic'",
- sqlVersion: "2015-10-08"
- });
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement