Cowboy in the desert.

Automatically provisioning Amazon EC2 instances with Tentacle installed

April 8, 2014

The Tentacle agent used by Octopus to automate deployments has long supported configuration via command line. It's possible to automatically download the MSI, install it, configure the Tentacle instance, and even register it with an Octopus server, all via the command line.

When provisioning a Windows server via Amazon EC2, you can pass a PowerShell script as User data. This will get executed when the EC2 instance starts for the first time:

Provisioning the EC2 instance

I've put together an example script based on our instructions on Automating Tentacle installation. You can find the script below. Paste it between the <powershell> XML elements, then wait for the machine to start. When it finally starts, the machine will be registered with your Octopus server:

It's alive!

If you hit any problems, remote to the machine and look at the following two files:

  • C:\TentacleInstallLog.txt
  • C:\Program Files\Amazon\Ec2ConfigService\Logs\Ec2ConfigLog.txt

Here's the PowerShell script:

When you set up your EC2 instance and assign a security group to it, make sure the Tentacle listen port that you specify (10933 by default) allows TCP traffic. The script automatically adds the exception to Windows Firewall, but you need to do the same for the AWS firewall.

For more information on EC2 instance provisioning and User Data, see: