Automation in Windows Instances on Amazon EC2

  • Partho

    I am working on a compute service that will require automatic deployment of our software (~30 megs). The software is a WCF service, so I am stuck with windows. I can't use mono because we use lots of classes that are not implemented in it.

    We could easily do the deployment on linux through SSH & SFTP, which are enabled by default. The telnet service has to be manually started on Windows instances. Is there a way to leverage RDP for this?

    I can create an AMI with telnet enabled. But, it seems like overkill.

    How do people automate the deployment on default windows instances? Or does everybody create an AMI with their softwares already installed?

  • Answers
  • Barak

    RDP is not a good choice for Windows automation.

    An alternative to ssh for windows is WinRM - Windows Remote management. Powershell has built-in support for WinRM. And if you are using EC2 (not listed in the question, but the question is tagged EC2), powershell is enabled on the Amazon default windows image. You just need to open port 5985 in your security group.

    There are some instructions on how to connect using powershell here:

    The alternative to SFTP for windows is CIFS (Windows file sharing), but it is not a particularly good option - the protocol is not encrypted. You can also transfer files using a powershell script - see a sample script here:

    If you are ok with creating your own AMI, install cygwin and its sshd server. This will give you file transfer and remote execution over ssh to your windows instance.

  • Evan Anderson

    RDP probably isn't the best way to do what you're looking for. PowerShell Remoting is probably your best method to give you a similar experience to your Linux deployment "story". You can get interactive shell sessions on remote machines or run scripts remotely.

    Being used to having an SFTP server included with the Linux OS, file transfer in the Windows world is going to feel like a bit of a hack.

    You can run the SMB file sharing protocol directly over the Internet, but this is generally regarded as a bit of a security risk.

    The RDP protocol has file transfer capability built-in, but using an RDP client in a batch / non-interactive manner is going to be a dodgy hack (not to mention that the file transfer mechanism in RDP is, itself, a bit of a dodgy hack).

    Powershell itself can download files from remote servers in a manner similar to wget. I don't do any code deployments to remote Windows servers in my work, but I'd strongly look at using this method to "pull" code out to the remote servers if I was since it uses only built-in functionality.

  • Janaka

    It's not clear if you are trying to automate the infrastructure as well as the WCF service deployment.

    Code deployment

    On Windows there are a couple of ways, no magic answer though I'm afraid, and the architecture is no different from Linux. The tools you use and which ones are available on Windows out of the box is where the differences are.

    1) Install one of SSH, SFTP, Telenet etc. and then use similar methods as you do now on Linux together with either batch or powershell. As Evan Anderson says, may be this feels weird to you because of the tools available on Linux.

    If you've worked with Java then the generic process is the same i.e. code needs to be built before deploying and all can be automated using batch script or powershell.

    2) The more scalable method is to use an automated deployment server such as Octopus (as an agent installed on the deployment target) and optionally a build server such as Jenkins or Bamboo. Along with your code residing in a code repo such as Git you can have continuous integration and deployment or manual automated based on a particular branch in your git repo.

    Again the generic process is the same as Java or some other language on Linux.

  • Related Question

    installation - Options for installing software on Amazon EC2 Windows instances
  • gareth_bowles

    I've been running Linux servers on Amazon EC2 for a while now; the experience has been great. I've recently needed to bring up a Windows server to run some Windows-only software that our product needs to use, and am running into a problem figuring out how to install the software, which is only available on DVD.

    With Linux I can just install packages from a Web-based repository and take advantage of EC2's fast network throughput, but so far on the Windows instance I've had to upload my ISO images to EC2 and mount them from the Windows EC2 instance. For some reason I'm getting really slow upload speeds to EC2, even though the regular upload speed from our office is pretty good (around 7Mbps).

    I've also tried mounting the DVD drive on my machine as a local drive on the EC2 instance via Remote Desktop, and then running the software install from the local drive, but I run into the same slow upload speed issue.

    Does anyone have a better way to install software from physical media onto an EC2 instance ?

  • Related Answers
  • Sam

    If your upload speed is generally pretty good, then it looks to be a slow upload to amazon, so using any sort of third party in the middle my help your speed, say uploading to and FTP site, then downloading from Amazon, which should be quicker than upload. Yes it involves an extra step, but it may make it quicker in the long run.

    If your trying to upload Microsoft media, if you have an MSDN or Technet subscription maybe you could download it from there?

  • Adam Brand

    You could send the ISO to yourself with yousendit, then download it from the instance. That's what we generally do with our servers.

  • Ameer Deen

    You probably know this already but I thought I might add this info for others who might be trying to install Microsoft products on EC2. If the software you are looking for is part of the Windows Server installation media, then Amazon makes available snapshots you can use to create volumes and attach to your instance.

    Configuring Windows Components on Amazon EC2

    From there, it's just like installing software from a local CD. Sam's already covered the other methods you might normally use.

  • Area 51

    assuming your software is on S3 you could use internet explorer (from within windows server) to download firefox then install S3Fox into firefox and download your files directly into the c drive or desktop on server. I tried to upload a 500mb file from my laptop - talk about being slow, I gave up! I estimate the firefox/s3Fox way is about 10 times quicker.