Octopus Deregister Lambda
An AWS Lambda function to deregister an EC2 instance from an
Octopus Deploy server when the instance is terminated.
It expects Octopus credentials to be stored in an S3 bucket. The EC2 instance needs to
be tagged with the Octopus machine name.
Building
Octopus Deregister is written in Go, and uses aws-lambda-go to bridge
Lambda's Python runtime to Go.
Run tests using go test ./...
.
Aws-lambda-go distributes a Docker container with build and packaging tools. Run
docker run --rm -v $GOPATH:$GOPATH -e GOPATH=$GOPATH -w `pwd` eawsy/aws-lambda-go
The output handler.zip
can then be uploaded to Lambda.
Function Configuration
The following configuration parameters are passed as lambda environment variables
Name |
Purpose |
Required |
OCTOPUS_API_KEY_BUCKET |
The S3 bucket name to access the Octopus API key |
Yes |
OCTOPUS_API_KEY_PATH |
The S3 object key to access the Octopus API key |
Yes |
OCTOPUS_URI |
URI for the Octopus server |
Yes |
DEBUG_LOG |
Enables debug logging if non-blank |
No |
EC2 Configuration
The lambda function expects the EC2 instance to have the tag octopus_name
set to the
Octopus display name for the instance.