aws-cloudformationamazon-kinesis-analytics

Start a Kinesis data analytics application with cloudformation


Is there a way to start a kinesis data analytics application via cloudformation?

In these instructions, under the Start the Application section, there are instructions for how to start a Kinesis Data Analytics application through the console or through aws cli.

Is there any way to start the application using cloudformation, instead of the cli or console?

Thank you in advance.


Solution

  • There is a way, but unfortunately, its not that straightforward.

    The first way would involve create a custom resource in CloudFormation. The resource would be a lambda, which you would write to start the Kinesis App from the CloudFormation.

    The second would be through a non-elegant substitute for a custom resource, but much easier to setup. This is done by using smallest instance possible (e.g. t2.nano) with instance shutdown behaviour set to terminate. So your template creates that instances, in UserData you start the Kinesis app, and shutdown the instance (shutdown -h now). This will terminate the instance after the start of the Kinesis due to shutdown behavior.

    Other ways would involve setting up notification when your cloudformation successfully deploys, and the notification would trigger a lambda which would start the Kinesis.

    Hope this helps.