I borrowed this script from Scott Bradley's wonderful blog "Provision and Bootstrap Windows EC2 Instances With Chef," making the following changes:
-
To make compatible with
Windows Server 2012 R2
, I added the following firewall rule to the powershell script section:netsh advfirewall firewall add rule name="WinRM in" protocol=TCP dir=in profile=any localport=5985 remoteip=any localip=any action=allow
-
Used
knife.rb
instead of using AWS API credentials -
Added
security-group-ids
andsubnet
flags to provision to ec2VPC