0

While launching an EC2 Instance of type "Microsoft Windows Server 2016 Base" , I provide the few commands in the user data section using <Powershell></powershell> but when my EC2 launches successfully, I do not see the scripts executed.

I am using the below script inside <Powershell></powershell>

Stop-Service -Name "Tomcat8"
cd "C:\Program Files\Apache Software Foundation\Tomcat 8.5\webapps"
rm ROOT -R
wget https://s3.ap-south-1.amazonaws.com/XYZ/ROOT.war -OutFile ROOT.war
Start-Service -Name "Tomcat8"

Do I need to enable something before launching the instance?

Before 2016 windows AMI, EC2Config Service was to be used to enable scripts to be run at launch, but I dont know how to do that on Microsoft Windows Server 2016.

3
  • Please post your code as a Minimal, Complete, and Verifiable example, see How to Ask for help with asking a great question. Commented Nov 10, 2017 at 11:38
  • @JamesC. thanks for feedback. I ave updated my question with the script I am using Commented Nov 10, 2017 at 11:54
  • Possible duplicate of Amazon EC2 custom AMI not running bootstrap (user-data) @SalilLambay There are instructions in the linked question for instances based on the WS 2016 AMI. EC2Config was replaced with EC2Launch in WS2016, you can check logs there for troubleshooting user-data. Commented Nov 10, 2017 at 17:23

0

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.