5.2. Launch instance

Launch the Red Hat AMI identified in Chapter 3, Identify a suitable Red Hat AMI, adding the following lines to the "User Data:" field, inserting your JBoss admin password instead of the placeholder.
JBOSSAS_ADMIN_PASSWORD=<your password for opening admin console>
JBOSS_IP=0.0.0.0 #listen on all IPs and interfaces
cat> $USER_SCRIPT << "EOF"
## Deploy your application from an Internet URL
# wget https://<your_secure_storage_hostname>/<path>/<app_name>.war -O /var/lib/jbossas/server/$JBOSSCONF/deploy/

## deploy sample application from the local filesystem
cp /usr/share/java/jboss-ec2-eap-samples/hello-1.0.war /var/lib/jbossas/server/$JBOSSCONF/deploy/hello.war
EOF
This example below deploys a sample application already on the Red Hat AMI. To deploy your own application instead, comment the line which deploys the sample application and uncomment the line which deploys your application, modifying the source URL as required.
If this is to be a production instance, add the following command under USER_SCRIPT in the "User Data:" field, to ensure that security updates are applied on boot:
Also ensure that yum -y update is run regularly to apply security fixes and enhancements.
yum -y update

Important

There are a number of parameters which can be used in the User Data field to customize the configuration and deployment of JBoss Enterprise Application Platform. Refer to Appendix A, User Script Parameters for details.