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.

  • Please post your code as a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve), see [How to Ask](http://stackoverflow.com/questions/how-to-ask) for help with asking a great question. – henrycarteruk Nov 10 '17 at 11:38
  • @JamesC. thanks for feedback. I ave updated my question with the script I am using – Salil Lambay Nov 10 '17 at 11:54
  • Possible duplicate of [Amazon EC2 custom AMI not running bootstrap (user-data)](https://stackoverflow.com/questions/26158411/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. – Anthony Neace Nov 10 '17 at 17:23

0 Answers0