Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

I'd like to launch an EC2 Windows instance, upload an EXEcutable & execute it (all in an automated fashion, this is important)

So far I was able to programmatically launch EC2 Windows instance & get its parameters (password / IP), now I'd like to find a way to upload this Executable (from my Windows machine or from my other EC2 Linux instance) & run it.

I thought about launching an RDP connection & using a macro software to upload & execute the file, but based on previous experiences this is a poor/fragile approach, to say the least.

I also thought about uploading this EXE to a server, then do something like this on Windows:


Except that Windows doesn't have wget!

So my question is: is there a way to programmatically upload & execute an EXEcutable in EC2 Windows instance?

1 Answer

0 votes
by (44.3k points)

In Windows, there is no default service like wget to execute the user-data-file when the instance gets booted. But, you can use this open source project CloudInit.NET project. But you will require .NET 4.8 (latest version) and CloudInit.NET installed in Windows instance. Then you can use this below command’s to execute the user-date-file:

!# /powershell/

$wc = New-Object System.Net.WebClient

$wc.DownloadFile("", "C:\your-file.exe");

& 'C:\your-file.exe'

Also, if you want this to be available whenever you need, then create an AMI of this instance and use it to launch your instance so that all of this will be installed already.

Related questions

0 votes
1 answer

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories