0

I have a nodejs script that creates a new ec2 instances with the given specifications using the AWS Node SDK. Now, I want to include a powershell script in the UserData parameter of the ec2.runInstances(..) method so that the instance executes this powershell script when its launching.

I know there is a way to include bash scripts in the cloud-init part in the UserData section for linux based ec2 instances. I am not sure if powershell script could be embedded in the cloud-init structure in UserData for windows ec2. Any pointers in this directions would be great. Thanks.

2 Answers 2

2

Use <powershell> ... </powershell> wrapper in userdata.

Sign up to request clarification or add additional context in comments.

Comments

0

According to http://cloudbase-init.readthedocs.org/en/latest/userdata.html it is #ps1_sysnative or #ps1_x86 for 32 bit mode. On EC2 the content should be enclosed in <powershell> and </powershell>.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.