Launching Lucee on Windows in AWS EC2

Hopefully this helps until Ortus makes their AWS instances available.

I recently had to upgrade my AWS Win2008 instances so I figured I’d make the move to Lucee since my ACF11 was end-of-support as well. After struggling a bit here’s a powershell script I came up with to document launching one from scratch. I had to go through this process a few times to get it right. When it didn’t work I’d just fire up a new instance and start over (I love AWS). I finally got it working on a Win19 Base instance which was easier with the GUI, then replicated my steps on Win19 Core, which allows me to run smoothly on a t3a.nano instance (1GB RAM) for now.

My only complaint about Win Server Core is that I haven’t found a way to install the Services management console, or figured out how to access service management remotely.

This is just the basics and could be improved, so please contribute.

  1. Launch instance with a security group that allows ports 3389 (Remote Desktop) and 8172 (Remote IIS Mgmt)
  2. When you’re able to connect to the instance, open PowerShell (from command prompt type “start powershell”)
  3. Type the following commands. You can copy and paste several to run them one after the other. From this point on instructions are made with PowerShell comments…
# Change the Administrator Password
$password = Read-Host "Enter new password for 'Administrator'"
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
$UserAccount = Get-LocalUser -Name "Administrator"
$UserAccount | Set-LocalUser -Password $securePassword

# Install Windows Update Module (only needed once). You'll be prompted to approve the untrusted repository
Install-Module PSWindowsUpdate 

# Get and install Windows Updates. To get or install individual updates, use parameter -KBArticleID (e.g. 'Install-WindowsUpdate -KBArticleID KB1234567')
Get-WindowsUpdate
Install-WindowsUpdate 

# You'll likely need to reboot after installing updates

# Install Windows Explorer (optional)
# I recommend this if you prefer to navigate the file system graphically.`
Add-WindowsCapability -Online -Name ServerCore.AppCompatibility~~~~0.0.1.0

# Mount additional EBS volumes
# Only necessary if you've attached additional volumes when launching your instance
invoke-expression -Command C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeDisks.ps1

# Install IIS and required modules for Lucee
Install-WindowsFeature Web-Server         # -IncludeManagementTools option doesn't activate inetmgr.exe
Install-WindowsFeature Web-Mgmt-Service
Install-WindowsFeature Web-Net-Ext45

# optional for lockdown
Install-WindowsFeature Web-IP-Security 

# not sure if the following are required, but were for ACF
Install-WindowsFeature Web-CGI
Install-WindowsFeature Web-ISAPI-Filter
Install-WindowsFeature Web-ISAPI-Ext
Install-WindowsFeature Web-Asp-Net45

# Set IIS to start automatically
Set-Service -Name WMSVC -StartupType Automatic
Start-Service -Name WMSVC

### Enable IIS Remote Management ###
# Windows Server Core doesn't include the IIS management console, but it's just as easy to manage remotely though from a Windows computer
Set-Itemproperty -path 'HKLM:\SOFTWARE\Microsoft\WebManagement\Server' -Name 'EnableRemoteManagement' -value '1'

# Mount local drive (optional)
# In this example my local drive D: will be available to the server as drive R: (remote)
# This just makes it slightly easier when copying files from your local drive from command line
# Not sure what happens if you connect to the server from a computer that doesn't have a local drive D:
New-PSDrive –Name “R” –PSProvider FileSystem –Root “\\tsclient\d” –Persist

# Change time zone (optional)
# Instance defaults to UTC
Set-TimeZone -Id "US Eastern Standard Time"

# Download & install Lucee (Check for preferred version at http://lucee.viviotech.net)
New-Item -Path 'c:\' -Name 'install' -ItemType 'directory'
Invoke-WebRequest 'http://lucee.viviotech.net/lucee-5.3.3.062-pl0-windows-installer.exe' -OutFile 'c:/install/lucee.exe'
Start-Process -FilePath 'c:/install/lucee.exe'

# You probably want to install the IIS URLRewrite module too
Invoke-WebRequest 'http://download.microsoft.com/download/C/F/F/CFF3A0B8-99D4-41A2-AE1A-496C08BEB904/WebPlatformInstaller_amd64_en-US.msi' -OutFile 'c:/install/WebPlatformInstaller.msi'
Start-Process -FilePath 'c:/install/WebPlatformInstaller.msi'

To manage IIS on your instance, open IIS Management Console on your local computer and select “Connect to a Server…” from the File menu. Type in your instance IP address and you can initially use your Administrator account to connect.
image

Good luck

6 Likes

I came across the powershell script to install Lucee in a windows instance. I am in the process of creating a docker image with Lucee in windows. I am currently running in local machine and the idea is to do the same in Azure CI/CD pipelines. I was able to successfully build an image and run in an container. But couldn’t access lucee admin. Probably I’m doing something wrong.

I’d been looking at the DockerFile for linux as well. https://github.com/isapir/lucee-docker/blob/master/Dockerfile. This has more options provided while installing lucee. Please let me know if you’ve successfully built a docker lucee image in windows.

I completely forgot about posting this! Hopefully it’s helped a few people.

Unfortunately I can’t help with this as I’ve never worked with docker. I was doing plenty of things wrong while working out this powershell script but eventually figured it out so I’m confident you’ll figure out the docker image as well. Good luck

2 Likes

Thank you :slight_smile: