Maven script for deploying project to Apache Tomcat on Amazon EC2

In the Deploying web application on remote tomcat post i listed steps for creating maven script that can install web application on remote Apache Tomcat. You could use the same concept to deploy web applications to Apache Tomcat running on Amazon EC2, by following these steps
  1. First change the tomcat-users.xml to add tomcatadmin user and give him manager-gui and manager-script roles
    
    <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
    <role rolename="tomcat"/>
    
    <role rolename="manager-gui"/>
    <role rolename="manager-script"/>
        
    <user username="tomcatadmin" password="tomcatadmin" roles="tomcat,manager-gui,manager-script"/>
    
    <user username="both" password="tomcat" roles="tomcat"/>
    <user username="role1" password="tomcat" roles="role1"/>
    </tomcat-users>
    
  2. Next change your <MVN_HOME>/settings.xml file to add AWSServer server with tomcatadmin as username passowrd, you shoudl use the user id password that you set in your tomcat-users.xml file here
    
     <server>
          <id>AWSServer</id>
          <username>tomcatadmin</username>
          <password>tomcatadmin</password>
      </server>
    
  3. Last step is to add following plugin to you pom.xml, in this value of url will be the ec2 instance DNS name and the value of server would be equal to id of server you set in settings.xml
    
     <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>tomcat-maven-plugin</artifactId>
        <configuration>
            <url>http://ec2-54-84-128-249.compute-1.amazonaws.com:8080/manager/text</url>
            <server>AWSServer</server>
            <path>/simplewebapp</path>
        </configuration>
    </plugin>
    
  4. Now execute mvn tomcat:redeploy to deploy your code to tomcat

6 comments:

Unknown said...

I knew it must be possible.
Works flawlessly. Thank you!

wapppictures said...

Wow! Totally what I needed.

Unknown said...

Nice post and great content.
Avast Customer Support is here to help you out with the whole procedure to Download Avast Antivirus online, We not only fix your Avast Support related issues but will guide with how to get started with your new Avast product once it gets installed successfully. We at Avast Tech Support provides service to protect your PC from potential online threats and external attacks like viruses, Trojans, malwares, spywares and phishing scams. And Avast Refund. Call on our Avast Phone Number

Gmail Customer service is a third party technical support service for Gmail users when they face any technical issue or error in their Gmail account. Our Gmail Customer Support team solves issues like forgot Gmail account password, Gmail configuration or Sync issues, recover deleted emails and many more. Toll Free number (800) 986-9271

How you install or reinstall Office 365 or Office 2016 depends on whether your Office product is part of an Office for home or Office for business plan. If you're not sure what you have, see what office com setup products are included in each plan and then follow the steps for your product. The steps below also apply if you're installing a single, stand-alone Office application such as Access 2016 or Visio 2016. Need Help with office setup Enter Product Key? Call 1-800-000-0000 Toll Free
Norton Tech Support is a third party service provider and not in any way associated with Norton or any of its partner companies. We offer support for Norton products and sell subscription based additional warranty on computer and other peripheral devices. Call our Toll Free number 1 855 966 3855
Other Services
Norton Toll Free , Office-Setup , office.com/setup.

Unknown said...

I am getting access denied:403 error

Anonymous said...

Thank you for sharing! Worked perfectly :-)

Abhi said...

Thanks for info....
Website development in Bangalore