Silent IIS UrlRewrite, ARR and FARM provisioning by #PowerShell

Recently, I had the task to run several fitnesse instances in on the single AWS EC2 instance. The requirement was what each fitnesse instance should be accessible trough port 80 (HTTP). IIS as reverse proxy came to the rescue. But there were one more requirement – IIS Reverse Proxy configuration should be automated.

Here >> konstantinvlasenko/IIS Reverse Proxy << you can find a complete PowerShell script how to install IIS and configure it as reverse proxy.

HOWTO: Create AWS EC2 spot instance with the specific IAM Role

Get IAMInstanceProfile

$iam=[Amazon.AWSClientFactory]::CreateAmazonIdentityManagementClient($awsKeyId, $awsKey)
$req = (new-object Amazon.IdentityManagement.Model.GetInstanceProfileRequest).WithInstanceProfileName('S3Reader')
$res = $iam.GetInstanceProfile($req1).GetInstanceProfileResult
$iamprofile = (new-object Amazon.EC2.Model.IAMInstanceProfile).WithArn($res.InstanceProfile.Arn).WithId($res.InstanceProfile.InstanceProfileId)

Create LaunchSpecification

$spec = (new-object Amazon.EC2.Model.LaunchSpecification).WithInstanceProfile($iamprofile).WithSecurityGroup('your security group')
$spec.ImageId = 'ami0000000'
$spec.InstanceType = 'm1.small'

Create spot request

$ec2=[Amazon.AWSClientFactory]::CreateAmazonEC2Client($awsKeyId, $awsKey)
$req = new-object Amazon.EC2.Model.RequestSpotInstancesRequest
$req.InstanceCount = 1
$req.SpotPrice = '0.02'
$req.LaunchSpecification = $spec

Windows Core: Install PowerShell 3.0 by using PowerShell 2.0

Run the script below in the PowerShell 2.0 on your Windows Core

(new-object System.Net.WebClient).DownloadFile('', 'c:\dotNetFx40_Full_x86_x64_SC.exe')
(new-object System.Net.WebClient).DownloadFile('', 'c:\Windows6.1-KB2506143-x64.msu')

It is not unattended installation. You will be prompted several times to click Next.