Deploying on Amazon EC2

Last modified by Ray Kiddy on 2021/05/08 20:56

Introduction

Amazon Elastic Compute Cloud (Amazon EC2) is part of Amazon Web Services. It provides "resizable compute capacity in the cloud"---in other words, it allows you to run what are essentially virtual private servers of various sizes and capabilities. It is relatively straightforward to set up a WebObjects application server on an EC2 instance. There are several flavours of Linux available as base images to customize.

First, keep in mind, though, that Amazon EC2 instances are just giving you instances of some different operating systems. For example, as of April 2021, one sees:

  • Amazon Linux 2

  • macOS (a few versions)]

  • Red Hat Enterprise Linux 8

  • Ubuntu Server

  • Microsoft Windows Server (many versions and configurations)

  • Debian

The installation instructions for a WebObjects deployment are exactly what those for your chosen operating system. If you have picked an operating system and the deployment instructions are old or incomplete, that should tell you something. There may be dragons.

Scripting

AWS is a great platform for scripted control of your EC2 instances. See https://aws.amazon.com/tools/ for information on command-line tools and SDKs for other languages, such as java, python, C++, and all the others needed for buzzword-compliance. Here is an example CLI script.



https://stedolan.github.io/jq/










     #!/bin/bash     # Note that these scripts rely on having 'StrictHostKeyChecking accept-new' in the ~/.ssh/config file.     #     # For jq, a sort of sed for json data, see      echo ""     id=`aws ec2 describe-instances | jq --raw-output '.Reservations[0].Instances[0].InstanceId'`     status=`aws ec2 describe-instances --instance-ids $id | jq --raw-output '.Reservations[0].Instances[0].State.Name'`     if [ $status = "running" ]; then         ip=`aws ec2 describe-instances --instance-ids $id | jq --raw-output '.Reservations[0].Instances[0].PublicIpAddress'`         echo "instance-id: $id status: $status 'ubuntu@$ip'"     else         echo "instance-id: $id status: $status"     fi     echo ""     exit 0

Amazon Linux 2

Instructions for Amazon Linux 2 are TBD.