I have a datapipeline application that I need to respond to. When it finishes, I ssh to an ec-2 instance and execute a script. What is the best way to do ssh to that box after datapipeline finishes? Should I use a lambda function and have it listen for datapline completion and ssh to that box and execute the script? I can't take the script off of that box.
-
can you please add more detail? For eg. are you running a shell activity? What kind of tasks/activities are in the shell script? – user1452132 Apr 30 '15 at 10:46
-
did my edits make things clearer? – bjamin Apr 30 '15 at 17:26
-
yes. It is helpful. – user1452132 Apr 30 '15 at 20:24
2 Answers
There are couple of solutions here that I can think of.
At the end of completion of Datapipeline, write a zero byte file on S3 to signal end of it. That S3 put can signal a Lambda function as you noted. But I do not know how to rexec a shell script.
Another approach is to install taskrunner on the ec2-box and make that participate in your Data pipeline. That shell script could be the 'activity' in the pipeline. Here is a how that can be done http://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-how-task-runner-user-managed.html This approach does not need to go outside your current Datapipeline control flow and if the shellscript fails for any reason, the pipeline would fail providing you with integrated view.

- 1,758
- 11
- 21
Here's what I ended up doing. I wrote a lambda application that reads the SNS message from datapipeline, pulled a PEM from an encrypted S3 bucket, and sshed into the box, and executed the shell script.

- 131
- 1
- 5