Can an EC2 instance be set to open a file after starting up?

excel vba excel-vba amazon-web-services amazon-ec2

85 观看

3回复

302 作者的声誉

My workflow often includes starting up a set of EC2 servers and let them work on different parts of a Excel workbook. its not ideal but thats how it is. I would like to automate this process as much as possible.

Ideally I would make an AMI that opened an Excel workbook on startup. This workbook would then autorun a script that fetched a named Excel workbook from a dropbox folder, opened that workbook and then ran its autoscript. This way all I had to do was to code the script for the second Excel workbook, give it the "magic" name, upload it to dropbox and start an appropriate number of instances of the AMi with the first workbook and shut them down after the work had been done and uploaded to the dropbox folder.

I know how to do all this, except opening the "bootstrap" Excel file after booting up the EC2 instance. Is this possible?

作者: user2523167 的来源 发布者: 2017 年 12 月 27 日

回应 (3)


0

1829 作者的声誉

Make an ami, that on startup calls an aws server setup as a controller. As many instances as you launch from the ami will call the controller and request work.

作者: N-ate 发布者: 27.12.2017 04:45

2

25593 作者的声誉

When you launch an EC2 instance you supply userdata. That userdata can be a script that is auto-run when the instance launches.

Another alternative is to use EC2 Systems Manager Run Command to remotely invoke operations/scripts on EC2 instances after they're launched - you could easily automate something to launch an instance, wait till it's ready, then remotely invoke your Excel script with some dynamic parameters.

Another alternative is to place the work items on an SQS queue, then use the userdata idea to run a script at instance launch that pulls items from the queue and does work.

And another idea is to use AWS Lambda. Simply upload the workbook to S3, and have that trigger a Lambda function. It could either read and process the entire workbook, or if you really need parts of the workbook to be processed by different tasks then your Lambda function could invoke a number of subordinate Lambda functions and fan out the parts of the workbook to them.

作者: jarmod 发布者: 27.12.2017 05:02

0

34 作者的声誉

You could create a windows service/task and execute a bat file on startup. The bat file would open the excel file run your script.

I think this approach might be simpler than using AWS services.

作者: Diego 发布者: 27.12.2017 11:28
32x32