I am creating a CloudFormation where:
- An instance is selected
- The CloudFormation template has inputs that are to be used in the script
- Executes this script into the selected instance
How do I execute a Powershell script from CloudFormation?
I am creating a CloudFormation where:
How do I execute a Powershell script from CloudFormation?
You can pass a PowerShell script via the User Data. It will be executed on the first startup of the instance.
Here is an example script:
<powershell>
$file = $env:SystemRoot + "\Temp\" + (Get-Date).ToString("MM-dd-yy-hh-mm")
New-Item $file -ItemType file
</powershell>
See: Running Commands on Your Windows Instance at Launch - Amazon Elastic Compute Cloud