Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(iot): TopicRule action for Step Functions in AWS IoT #17698

Closed
2 tasks
yamatatsu opened this issue Nov 25, 2021 · 5 comments · Fixed by #26059
Closed
2 tasks

(iot): TopicRule action for Step Functions in AWS IoT #17698

yamatatsu opened this issue Nov 25, 2021 · 5 comments · Fixed by #26059
Labels
@aws-cdk/aws-iot Related to AWS IoT effort/small Small work item – less than a day of effort feature/service-integration Add functionality to an L2 construct to enable easier integration with another service feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2

Comments

@yamatatsu
Copy link
Contributor

Description

The CDK has no support to trigger Step Functions via AWS IoT Rule.

Use Case

Adding the action that triggers Step Functions to AWS IoT topic rule.

Proposed Solution

Implementing action class.

Probably, following PRs help coding.

Other information

Follofing documentation will be help.

It will be good first issue for learning implement feature in CDK!

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change
@yamatatsu yamatatsu added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Nov 25, 2021
@github-actions github-actions bot added the @aws-cdk/aws-iot Related to AWS IoT label Nov 25, 2021
@peterwoodworth peterwoodworth added effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p2 and removed needs-triage This issue or PR still needs to be triaged. labels Nov 26, 2021
@peterwoodworth peterwoodworth added the feature/service-integration Add functionality to an L2 construct to enable easier integration with another service label Nov 26, 2021
@sholtomaud
Copy link

any update on this issue? Has the feature been implemented in v2?

@yamatatsu
Copy link
Contributor Author

@sholtomaud Nope yet. But you can use escape-hatch as following:

import * as iot from '@aws-cdk/aws-iot-alpha';

const stateMachine = new new sfn.StateMachine(this, 'StateMachine', {
  definition,
});

const role = new iam.Role(this, 'MyRole', {
  assumedBy: new iam.ServicePrincipal('iot.amazonaws.com'),
});
stateMachine.grantStartExecution(role);

new iot.TopicRule(this, 'TopicRule', {
  sql: iot.IotSql.fromStringAsVer20151008("SELECT topic(2) as device_id FROM 'device/+/data'"),
  actions: [
    {
      bind: () => ({
        configuration: {
          stepFunctions: {
            stateMachineName: stateMachine.stateMachineName,
            executionNamePrefix: "myExecution", // optional
            roleArn: role.roleArn,
          }
        },
      }),
    },
  ],
});

This example needs to install @aws-cdk/aws-iot-alpha if you are using aws-cdk v2.

@sholtomaud
Copy link

Ok, looks interesting.

@Bakhoj
Copy link

Bakhoj commented Jun 2, 2022

Is there a dirty fix when using python?

@mergify mergify bot closed this as completed in #26059 Jun 30, 2023
mergify bot pushed a commit that referenced this issue Jun 30, 2023
Add new IoT topic rule action to send IoT messages to Step Functions State Machines.

Closes #17698.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-iot Related to AWS IoT effort/small Small work item – less than a day of effort feature/service-integration Add functionality to an L2 construct to enable easier integration with another service feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants