I have a simple Windows Powershell script I would like to have run on an EC2 instance when it launches within an Elastic Beanstalk environment. It simply sets up a self-signed SSL certificate and binds it to the default web site in IIS.
I know this can be done with an EC2 instance individually by using UserData (as shown below)... but how do I do it with any instance spun up inside an EB environment?
<powershell>
Import-Module WebAdministration
Set-Location IIS:\SslBindings
New-WebBinding -Name "Default Web Site" -IP "*" -Port 443 -Protocol https
$c = New-SelfSignedCertificate -DnsName "domain.com" -CertStoreLocation cert:\LocalMachine\My
$c | New-Item 0.0.0.0!443
</powershell>