{"id":13522116,"url":"https://github.com/shogo82148/p5-aws-lambda","last_synced_at":"2025-04-13T03:08:17.947Z","repository":{"id":33833233,"uuid":"161093578","full_name":"shogo82148/p5-aws-lambda","owner":"shogo82148","description":"AWS Lambda Layer for Perl5","archived":false,"fork":false,"pushed_at":"2025-02-04T22:27:14.000Z","size":1079,"stargazers_count":25,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-13T03:08:09.903Z","etag":null,"topics":["aws-lambda","perl"],"latest_commit_sha":null,"homepage":"https://metacpan.org/pod/AWS::Lambda","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shogo82148.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["shogo82148"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-12-10T00:06:58.000Z","updated_at":"2025-02-04T22:10:20.000Z","dependencies_parsed_at":"2023-11-29T15:49:22.154Z","dependency_job_id":"308aeefb-adf8-45db-bd63-fe4b1f7b8948","html_url":"https://github.com/shogo82148/p5-aws-lambda","commit_stats":{"total_commits":393,"total_committers":4,"mean_commits":98.25,"dds":"0.020356234096692072","last_synced_commit":"19327a4201f207cf262abcaff5026a1f290075a3"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shogo82148%2Fp5-aws-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shogo82148%2Fp5-aws-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shogo82148%2Fp5-aws-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shogo82148%2Fp5-aws-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shogo82148","download_url":"https://codeload.github.com/shogo82148/p5-aws-lambda/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657918,"owners_count":21140846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-lambda","perl"],"created_at":"2024-08-01T06:00:42.502Z","updated_at":"2025-04-13T03:08:17.928Z","avatar_url":"https://github.com/shogo82148.png","language":"Perl","funding_links":["https://github.com/sponsors/shogo82148"],"categories":["Layers"],"sub_categories":["Runtimes"],"readme":"[![Actions Status](https://github.com/shogo82148/p5-aws-lambda/workflows/Test/badge.svg)](https://github.com/shogo82148/p5-aws-lambda/actions)\n# NAME\n\nAWS::Lambda - Perl support for AWS Lambda Custom Runtime.\n\n# SYNOPSIS\n\nSave the following Perl script as `handler.pl`.\n\n    sub handle {\n        my ($payload, $context) = @_;\n        return $payload;\n    }\n    1;\n\nand then, zip the script.\n\n    $ zip handler.zip handler.pl\n\nFinally, create new function using awscli.\n\n    $ aws --region \"$REGION\" --profile \"$PROFILE\" lambda create-function \\\n        --function-name \"hello-perl\" \\\n        --zip-file \"fileb://handler.zip\" \\\n        --handler \"handler.handle\" \\\n        --runtime provided.al2023 \\\n        --role arn:aws:iam::xxxxxxxxxxxx:role/service-role/lambda-custom-runtime-perl-role \\\n        --layers \"arn:aws:lambda:$REGION:445285296882:layer:perl-5-38-runtime-al2023-x86_64:1\"\n\nIt also supports [response streaming](https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html).\n\n    sub handle {\n        my ($payload, $context) = @_;\n        return sub {\n            my $responder = shift;\n            my $writer = $responder-\u003e('application/json');\n            $writer-\u003ewrite('{\"foo\": \"bar\"}');\n            $writer-\u003eclose;\n        };\n    }\n\n# DESCRIPTION\n\nThis package makes it easy to run AWS Lambda Functions written in Perl.\n\n## Use Pre-built Public Lambda Layers\n\n1. Login to your AWS Account and go to the Lambda Console.\n2. Create a new function and give it a name and an IAM Role.\n3. For the \"Runtime\" selection, select **Provide your own bootstrap on Amazon Linux 2**.\n4. In the \"Designer\" section of your function dashboard, select the **Layers** box.\n5. Scroll down to the \"Layers\" section and click **Add a layer**.\n6. Select the **Provide a layer version ARN** option, then copy/paste the Layer ARN for your region.\n7. Click the **Add** button.\n8. Click **Save** in the upper right.\n9. Upload your code and start using Perl in AWS Lambda!\n\nYou can get the layer ARN in your script by using `get_layer_info`.\n\n    use AWS::Lambda;\n    my $info = AWS::Lambda::get_layer_info_al2023(\n        \"5.38\",      # Perl Version\n        \"us-east-1\", # Region\n        \"x86_64\",    # Architecture (\"x86_64\" or \"arm64\", optional, the default is \"x86_64\")\n    );\n    say $info-\u003e{runtime_arn};     # arn:aws:lambda:us-east-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:1\n    say $info-\u003e{runtime_version}; # 1\n    say $info-\u003e{paws_arn}         # arn:aws:lambda:us-east-1:445285296882:layer:perl-5-38-paws-al2023-x86_64:1\n    say $info-\u003e{paws_version}     # 1,\n\nOr, you can use following one-liner.\n\n    perl -MAWS::Lambda -e 'AWS::Lambda::print_runtime_arn_al2023(\"5.38\", \"us-east-1\")'\n    perl -MAWS::Lambda -e 'AWS::Lambda::print_paws_arn_al2023(\"5.38\", \"us-east-1\")'\n\nThe list of all layer ARNs is available on [AWS::Lambda::AL2023](https://metacpan.org/pod/AWS%3A%3ALambda%3A%3AAL2023).\n\n## Use Pre-built Zip Archives\n\n1. Login to your AWS Account and go to the Lambda Console.\n2. Create a new layer and give it a name.\n3. For the \"Code entry type\" selection, select **Upload a file from Amazon S3**.\n4. In the \"License\" section, input [https://github.com/shogo82148/p5-aws-lambda/blob/main/LICENSE](https://github.com/shogo82148/p5-aws-lambda/blob/main/LICENSE).\n5. Click **Create** button.\n6. Use the layer created. For detail, see Use Prebuilt Public Lambda Layer section.\n\nURLs for Zip archives are here.\n\n`https://shogo82148-lambda-perl-runtime-$REGION.s3.amazonaws.com/perl-$VERSION-runtime-al2023-$ARCHITECTURE.zip`\n\n## Use Pre-built Docker Images\n\nPrebuilt Docker Images based on [https://gallery.ecr.aws/lambda/provided](https://gallery.ecr.aws/lambda/provided) are available.\nYou can pull from [https://gallery.ecr.aws/shogo82148/p5-aws-lambda](https://gallery.ecr.aws/shogo82148/p5-aws-lambda) or [https://hub.docker.com/r/shogo82148/p5-aws-lambda](https://hub.docker.com/r/shogo82148/p5-aws-lambda),\nbuild your custom images and deploy them to AWS Lambda.\n\nHere is an example of Dockerfile.\n\n    FROM shogo82148/p5-aws-lambda:base-5.38.al2023\n    # or if you want to use ECR Public.\n    # FROM public.ecr.aws/shogo82148/p5-aws-lambda:base-5.38.al2023\n    COPY handler.pl /var/task/\n    CMD [ \"handler.handle\" ]\n\nBuild the hello-perl container image locally:\n\n    $ docker build -t hello-perl .\n\nTo check if this is working, start the container image locally using the Lambda Runtime Interface Emulator:\n\n    $ docker run -p 9000:8080 hello-perl:latest\n\nNow, you can test a function invocation with cURL.\n\n    $ curl -XPOST \"http://localhost:9000/2015-03-31/functions/function/invocations\" -d '{}'\n\nTo upload the container image, you need to create a new ECR repository in your account and tag the local image to push it to ECR.\n\n    $ aws ecr create-repository --repository-name hello-perl --image-scanning-configuration scanOnPush=true\n    $ docker tag hello-perl:latest 123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest\n    $ aws ecr get-login-password | docker login --username AWS --password-stdin 123412341234.dkr.ecr.sa-east-1.amazonaws.com\n    $ docker push 123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest\n\nFinally, create new function using awscli.\n\n    $ aws --region \"$REGION\" --profile \"$PROFILE\" lambda create-function \\\n        --function-name \"hello-perl\" \\\n        --code ImageUri=123412341234.dkr.ecr.sa-east-1.amazonaws.com/hello-perl:latest \\\n        --handler \"handler.handle\" \\\n        --runtime provided.al2023 \\\n        --role arn:aws:iam::xxxxxxxxxxxx:role/service-role/lambda-custom-runtime-perl-role\n\n## Run in Local using Docker\n\nPrebuilt Docker Images based on [https://hub.docker.com/r/lambci/lambda/](https://hub.docker.com/r/lambci/lambda/) are available.\nYou can pull from [https://gallery.ecr.aws/shogo82148/p5-aws-lambda](https://gallery.ecr.aws/shogo82148/p5-aws-lambda) or [https://hub.docker.com/r/shogo82148/p5-aws-lambda](https://hub.docker.com/r/shogo82148/p5-aws-lambda),\nand build zip archives to deploy.\n\n    # Install the dependency.\n    docker run --rm -v $(PWD):/var/task shogo82148/p5-aws-lambda:build-5.38.al2023 \\\n        cpanm --notest --local-lib extlocal --no-man-pages --installdeps .\n\n    # run an event.\n    docker run --rm -v $(PWD):/var/task shogo82148/p5-aws-lambda:5.38.al2023 \\\n        handler.handle '{\"some\":\"event\"}'\n\n## Pre-installed modules\n\nThe following modules are pre-installed for convenience.\n\n- [AWS::Lambda](https://metacpan.org/pod/AWS%3A%3ALambda)\n- [AWS::XRay](https://metacpan.org/pod/AWS%3A%3AXRay)\n- [JSON](https://metacpan.org/pod/JSON)\n- [Cpanel::JSON::XS](https://metacpan.org/pod/Cpanel%3A%3AJSON%3A%3AXS)\n- [JSON::MaybeXS](https://metacpan.org/pod/JSON%3A%3AMaybeXS)\n- [YAML](https://metacpan.org/pod/YAML)\n- [YAML::Tiny](https://metacpan.org/pod/YAML%3A%3ATiny)\n- [YAML::XS](https://metacpan.org/pod/YAML%3A%3AXS)\n- [Net::SSLeay](https://metacpan.org/pod/Net%3A%3ASSLeay)\n- [IO::Socket::SSL](https://metacpan.org/pod/IO%3A%3ASocket%3A%3ASSL)\n- [Mozilla::CA](https://metacpan.org/pod/Mozilla%3A%3ACA)\n- [local::lib](https://metacpan.org/pod/local%3A%3Alib)\n\n[Paws](https://metacpan.org/pod/Paws) is optional. See the \"Paws SUPPORT\" section.\n\n## AWS X-Ray SUPPORT\n\n[AWS X-Ray](https://aws.amazon.com/xray/) is a service that collects data about requests that your application serves.\nYou can trace AWS Lambda requests and sends segment data with pre-install module [AWS::XRay](https://metacpan.org/pod/AWS%3A%3AXRay).\n\n    use utf8;\n    use warnings;\n    use strict;\n    use AWS::XRay qw/ capture /;\n\n    sub handle {\n        my ($payload, $context) = @_;\n        capture \"myApp\" =\u003e sub {\n            capture \"nested\" =\u003e sub {\n                # do something ...\n            };\n        };\n        capture \"another\" =\u003e sub {\n            # do something ...\n        };\n        return;\n    }\n\n    1;\n\n# Paws SUPPORT\n\nIf you want to call AWS API from your Lambda function,\nyou can use a pre-built Lambda Layer for [Paws](https://metacpan.org/pod/Paws) - A Perl SDK for AWS (Amazon Web Services) APIs.\n\n## Use Prebuilt Public Lambda Layers\n\nAdd the perl-runtime layer and the perl-paws layer into your lambda function.\n\n    aws --region \"$REGION\" --profile \"$PROFILE\" lambda create-function \\\n        --function-name \"hello-perl\" \\\n        --zip-file \"fileb://handler.zip\" \\\n        --handler \"handler.handle\" \\\n        --runtime provided.al2023 \\\n        --role arn:aws:iam::xxxxxxxxxxxx:role/service-role/lambda-custom-runtime-perl-role \\\n        --layers \\\n            \"arn:aws:lambda:$REGION:445285296882:layer:perl-5-38-runtime-al2023-x86_64:5\" \\\n            \"arn:aws:lambda:$REGION:445285296882:layer:perl-5-38-paws-al2023-x86_64:4\"\n\nNow, you can use [Paws](https://metacpan.org/pod/Paws) to call AWS API from your Lambda function.\n\n    use Paws;\n    my $obj = Paws-\u003eservice('...');\n    my $res = $obj-\u003eMethodCall(Arg1 =\u003e $val1, Arg2 =\u003e $val2);\n    print $res-\u003eAttributeFromResult;\n\nThe list of all layer ARNs is available on [AWS::Lambda::AL2023](https://metacpan.org/pod/AWS%3A%3ALambda%3A%3AAL2023).\n\nURLs for Zip archive are:\n\n`https://shogo82148-lambda-perl-runtime-$REGION.s3.amazonaws.com/perl-$VERSION-paws-al2-$ARCHITECTURE.zip`\n\n## Use Prebuilt Docker Images for Paws\n\nuse the `base-$VERSION-paws.al2023` tag on [https://gallery.ecr.aws/shogo82148/p5-aws-lambda](https://gallery.ecr.aws/shogo82148/p5-aws-lambda) or [https://hub.docker.com/r/shogo82148/p5-aws-lambda](https://hub.docker.com/r/shogo82148/p5-aws-lambda).\n\n    FROM shogo82148/p5-aws-lambda:base-5.38-paws.al2023\n    # or if you want to use ECR Public.\n    # FROM public.ecr.aws/shogo82148/p5-aws-lambda:base-5.38-paws.al2023\n    COPY handler.pl /var/task/\n    CMD [ \"handler.handle\" ]\n\n## Run in Local using Docker for Paws\n\nuse the `build-$VERSION-paws.al2023` and `$VERSION-paws.al2023` tag on [https://gallery.ecr.aws/shogo82148/p5-aws-lambda](https://gallery.ecr.aws/shogo82148/p5-aws-lambda) or [https://hub.docker.com/r/shogo82148/p5-aws-lambda](https://hub.docker.com/r/shogo82148/p5-aws-lambda).\n\n    # Install the dependency.\n    docker run --rm -v $(PWD):/var/task shogo82148/p5-aws-lambda:build-5.38-paws.al2023 \\\n        cpanm --notest --local-lib extlocal --no-man-pages --installdeps .\n\n    # run an event.\n    docker run --rm -v $(PWD):/var/task shogo82148/p5-aws-lambda:5.38-paws.al2023 \\\n        handler.handle '{\"some\":\"event\"}'\n\n# CREATE MODULE LAYER\n\nTo create custom module layer such as the Paws Layer,\ninstall the modules into `/opt/lib/perl5/site_perl` in the layer.\n\n    # Create Some::Module Layer\n    docker run --rm \\\n        -v $(PWD):/var/task \\\n        -v $(PATH_TO_LAYER_DIR)/lib/perl5/site_perl:/opt/lib/perl5/site_perl \\\n        shogo82148/p5-aws-lambda:build-5.38.al2023 \\\n        cpanm --notest --no-man-pages Some::Module\n    cd $(PATH_TO_LAYER_DIR) \u0026\u0026 zip -9 -r $(PATH_TO_DIST)/some-module.zip .\n\n# MAINTENANCE AND SUPPORT\n\nSupported Perl versions are the same as those officially supported by the Perl community ([perlpolicy](https://metacpan.org/pod/perlpolicy)).\nIt means that we support the two most recent stable release series.\n\n# LEGACY CUSTOM RUNTIME ON AMAZON LINUX\n\nWe also provide the layers for legacy custom runtime as known as \"provided\".\nThese layers are only for backward compatibility.\nWe recommend to migrate to Amazon Linux 2.\nThese layers are NO LONGER MAINTAINED and WILL NOT RECEIVE ANY UPDATES.\n\nThe list of all layer ARNs is availeble on [AWS::Lambda::AL](https://metacpan.org/pod/AWS%3A%3ALambda%3A%3AAL).\n\n## Pre-built Zip Archives for Amazon Linux\n\nURLs of zip archives are here:\n\n`https://shogo82148-lambda-perl-runtime-$REGION.s3.amazonaws.com/perl-$VERSION-runtime.zip`\n\nAnd Paws:\n\n`https://shogo82148-lambda-perl-runtime-$REGION.s3.amazonaws.com/perl-$VERSION-paws.zip`\n\n# LEGACY CUSTOM RUNTIME ON AMAZON LINUX 2\n\nPreviously, we provided the layers that named without CPU architectures.\nThese layers are compatible with x86\\_64 and only for backward compatibility.\nWe recommend to specify the CPU architecture.\nThese layers are NO LONGER MAINTAINED and WILL NOT RECEIVE ANY UPDATES.\n\n## Pre-built Legacy Public Lambda Layers for Amazon Linux 2\n\nThe list of all layer ARN is available on [AWS::Lambda::AL2](https://metacpan.org/pod/AWS%3A%3ALambda%3A%3AAL2).\n\n## Pre-built Legacy Zip Archives for Amazon Linux 2 x86\\_64\n\nURLs of zip archives are here:\n\n`https://shogo82148-lambda-perl-runtime-$REGION.s3.amazonaws.com/perl-$VERSION-runtime-al2.zip`\n\nAnd Paws:\n\n`https://shogo82148-lambda-perl-runtime-$REGION.s3.amazonaws.com/perl-$VERSION-paws-al2.zip`\n\n# SEE ALSO\n\n- [AWS::Lambda::AL2023](https://metacpan.org/pod/AWS%3A%3ALambda%3A%3AAL2023)\n- [AWS::Lambda::AL2](https://metacpan.org/pod/AWS%3A%3ALambda%3A%3AAL2)\n- [AWS::Lambda::AL](https://metacpan.org/pod/AWS%3A%3ALambda%3A%3AAL)\n- [AWS::Lambda::Bootstrap](https://metacpan.org/pod/AWS%3A%3ALambda%3A%3ABootstrap)\n- [AWS::Lambda::Context](https://metacpan.org/pod/AWS%3A%3ALambda%3A%3AContext)\n- [AWS::Lambda::PSGI](https://metacpan.org/pod/AWS%3A%3ALambda%3A%3APSGI)\n- [Paws](https://metacpan.org/pod/Paws)\n- [AWS::XRay](https://metacpan.org/pod/AWS%3A%3AXRay)\n\n# LICENSE\n\nThe MIT License (MIT)\n\nCopyright (C) ICHINOSE Shogo\n\n# AUTHOR\n\nICHINOSE Shogo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshogo82148%2Fp5-aws-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshogo82148%2Fp5-aws-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshogo82148%2Fp5-aws-lambda/lists"}