Reputation: 2298
I am creating a CloudFormation where:
How do I execute a Powershell script from CloudFormation?
Upvotes: 0
Views: 621
Reputation: 269111
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
Upvotes: 1