NAME
AWS::Lambda - It's Perl support for AWS Lambda Custom Runtime.
SYNOPSIS
Save the following Perl script as handler.pl.
sub handle {
my ($payload, $context) = @_;
return $payload;
}
and then, zip the script.
zip handler.zip handler.pl
Finally, create new function using awscli.
aws --region "$REGION" --profile "$PROFILE" lambda create-function \
--function-name "hello-perl" \
--zip-file "fileb://handler.zip" \
--handler "handler.function" \
--runtime provided \
--role arn:aws:iam::xxxxxxxxxxxx:role/service-role/lambda-custom-runtime-perl-role \
--layers "arn:aws:lambda:$REGION:445285296882:layer:perl-5-28-runtime:5"
DESCRIPTION
This package makes it easy to run AWS Lambda Functions written in Perl.
Use Prebuild Public Lambda Layer
- Login to your AWS Account and go to the Lambda Console.
- Create a new function and give it a name and an IAM Role.
- For the "Runtime" selection, select Use custom runtime in function code or layer.
- In the "Designer" section of your function dashboard, select the Layers box.
- Scroll down to the "Referenced Layers" section and click Add a layer.
- Select the Provide a layer version ARN option, then copy/paste the Layer ARN for your region.
- Click the Add button.
- Click Save in the upper right.
- Upload your code and start using Perl in AWS Lambda!
The Layer ARN list is here.
- Perl 5.28
arn:aws:lambda:ap-northeast-1:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:ap-northeast-2:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:ap-south-1:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:ap-southeast-1:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:ap-southeast-2:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:ca-central-1:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:eu-central-1:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:eu-west-1:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:eu-west-2:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:eu-west-3:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:sa-east-1:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:us-east-1:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:us-east-2:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:us-west-1:445285296882:layer:perl-5-28-runtime:7arn:aws:lambda:us-west-2:445285296882:layer:perl-5-28-runtime:7
- Perl 5.26
arn:aws:lambda:ap-northeast-1:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:ap-northeast-2:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:ap-south-1:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:ap-southeast-1:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:ap-southeast-2:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:ca-central-1:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:eu-central-1:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:eu-west-1:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:eu-west-2:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:eu-west-3:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:sa-east-1:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:us-east-1:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:us-east-2:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:us-west-1:445285296882:layer:perl-5-26-runtime:7arn:aws:lambda:us-west-2:445285296882:layer:perl-5-26-runtime:7
Use Prebuild Zip Archive
- Login to your AWS Account and go to the Lambda Console.
- Create a new layer and give it a name.
- For the "Code entry type" selection, select Upload a file from Amazon S3.
- In the "License" section, input https://github.com/shogo82148/p5-aws-lambda/blob/master/LICENSE.
- Click Create button.
- Use the layer created. For detail, see Use Prebuild Public Lambda Layer section.
URLs for Zip archive are here.
https://s3-$REGION.amazonaws.com/shogo82148-lambda-perl-runtime-$REGION/perl-$VERSION-runtime.zip
Run in Local using Docker
Here is prebuild docker image based on https://hub.docker.com/r/lambci/lambda/
-
https://hub.docker.com/r/shogo82148/p5-aws-lambda
Install the dependency.
docker run --rm -v $(PWD):/var/task shogo82148/p5-aws-lambda:build-5.28
cpanm --notest -L extlocal --installdeps .run an event.
docker run --rm -v $(PWD):/var/task shogo82148/p5-aws-lambda:5.28
handler.handle '{"some":"event"}'
Install the dependency.
run an event.
SEE ALSO
LICENSE
The MIT License (MIT)
Copyright (C) Ichinose Shogo.
AUTHOR
Ichinose Shogo shogo82148@gmail.com