How to install the AWS Secret Plugin as a Lambda Function

This is a living document (i.e. incomplete) that describes how to deploy the AWS Secrets plugin as a Lambda function. I will refine this document over time, but to start, here is a script that can be used to build the plugin, create the lambda function, and update the lambda function:

#!/bin/sh

export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0

set -x
set -e

go build -o release/linux/amd64/drone-aws-secrets-manager \
  github.com/drone/drone-amazon-secrets/cmd/drone-amazon-secrets-lambda

cd release/linux/amd64/
zip drone-aws-secrets-manager.zip ./drone-aws-secrets-manager

aws lambda create-function \
   --region us-east-1 \
   --function-name drone-aws-secrets-manager \
   --memory 128 \
   --role arn:aws:iam::xxxxxxxx:role/secrets-manager \
   --runtime go1.x \
   --zip-file fileb://drone-aws-secrets-manager.zip \
   --environment Variables={DRONE_SECRET=xxxxxxxxxxxx} \
   --handler drone-aws-secrets-manager

aws lambda update-function-code \
  --region us-east-1 \
  --function-name drone-aws-secrets-manager \
  --zip-file fileb://drone-aws-secrets-manager.zip

Thanks for the Script, but what to do with this?

I do want to use aws secrets inside drone. But the documentation says to use a docker image, (which is not available) in another post you are saying that it’s supposed to be used as a lambda function.

But I can’t find a way to use the lambda function.

What are the steps to integrate it in the drone setup?

Thanks in advance for any hints or documents which I can use.