{"id":15017274,"url":"https://github.com/pplu/perl-lambda-byor","last_synced_at":"2025-04-09T19:42:13.265Z","repository":{"id":66753298,"uuid":"160274025","full_name":"pplu/perl-lambda-byor","owner":"pplu","description":"Perl Custom Runtime for writing AWS Lambda functions in Perl","archived":false,"fork":false,"pushed_at":"2019-04-11T21:09:36.000Z","size":32899,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T21:35:55.384Z","etag":null,"topics":["aws","byor","custom-runtime","lambda","perl","perl5"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pplu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-12-04T00:49:51.000Z","updated_at":"2022-12-20T07:00:31.000Z","dependencies_parsed_at":"2023-02-24T16:15:13.658Z","dependency_job_id":null,"html_url":"https://github.com/pplu/perl-lambda-byor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplu%2Fperl-lambda-byor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplu%2Fperl-lambda-byor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplu%2Fperl-lambda-byor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplu%2Fperl-lambda-byor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pplu","download_url":"https://codeload.github.com/pplu/perl-lambda-byor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248100968,"owners_count":21047880,"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","byor","custom-runtime","lambda","perl","perl5"],"created_at":"2024-09-24T19:50:14.834Z","updated_at":"2025-04-09T19:42:13.260Z","avatar_url":"https://github.com/pplu.png","language":"Perl","readme":"Custom Lambda Runtime for Perl\n==============================\n\nThis is an experiment to get Perl support in Lambda.\n\nIt consists of an implementation of the `bootstrap` script as [AWS documentation suggests](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html).\n\nThe implementation is not complete yet, though it does work to some extent :)\n\nInstall AWS::Lambda::Toolkit\n============================\n\n```\ncpanm AWS::Lambda::Toolkit\n```\n\n(Note: you might need to install the `cpanminus` system package to get access to the cpanm command).\n\nThis installs the utilities that help us bootstrap the Lambda environment.\n\nNote2: While the distribution is not uploaded to CPAN, you can install this way:\n\n```\ngit clone git@github.com:pplu/perl-lambda-byor.git\nmake dist\ncpanm AWS-Lambda-Toolkit-0.01.tar.gz\n```\n\nCreate your Lambda function\n===========================\n\n - Create a directory for your Lambda project:\n\n```\nmkdir my-lambda-project\ncd my-lambda-project\n```\n\n - Initialize the directory as a lambda project:\nCreate a config file named `lambda-perl.config` for your project\n```\ninit-lambda-perl\n```\n - Create a runtime layer\n\nAlthough Perl is installed in the Lambda environment, since AWS bases the OS on CentOS, the Perl runtime is quite old (5.16, where at the time of this\nwriting Perl has gone through 5.18, 5.20, 5.22, 5.24, 5.26 and 5.28 releases). Added to that, the Perl installation is lacking the 'perl-core' yum\npackage, which makes that Perl very hard to deal with, since it's lacking almost all of the \"core\" modules that you would normally find installed\non a system. Because of that, we're going to use custom compiled, modern versions of Perl as the runtime.\n\n```\nbuild-lambda-perl-runtime 5.28\n```\n\nwill generate a `layers/perl_5.28.zip`. This can be uploaded to Lambda as a layer with `install-lambda-perl-runtime`.\n\n - Create a cpanfile with the dependencies of your project\n\n```\nrequires 'Moo';\n```\n\nGenerate the dependencies layer with:\n\n```\nbuild-lambda-deps-layer\n```\n\nthis will generate another zip file in the layers directory that can be uploaded with `install-lambda-deps`\n\n - Write code. Start a file called `lambda`. Write a Perl subroutine:\n\n```\nsub main {\n  return \"I'm alive!\"\n}\n```\n\nCreate a zip with with the `build-lambda-function`. This creates a zip with the code in the layers directory\n\nConfigure the `lambda-perl.config` file:\n\nAdd the config keys:\n \n```\nhandler: lambda.main\nrole: arn:aws:iam::XXXXX:role/XXXXX\n```\n\nhandler is formed by the name of the file that contains the lambda function (`lambda` in this example), followed\nby `.` and the subroutine to invoke in that file.\n\nInvoke `install-lambda-function` to up create the lambda function in AWS.\n\n - Invoke the function\n\nYou can invoke the function with the AWS CLI, or with Paws: `paws Lambda --region x Invoke FunctionName TheNameOfYourLambda Payload ''`\n\nThe bootstrap script will require the `lambda` file (or whatever the handler of the Lambda function tells it to), and will invoke the `main` sub in \nthe lambda file with the parsed JSON payload passed to the function as a hashref as it's first argument.\n\nTODO\n====\n\nMake bootstrap include '/var/task/lib' so the libs in your project directory are usable from the lambda function\n\nautomatically encode the return value from the function to JSON? (should it be overridable?)\n\nAdaptor for ALB incoming message format to Plack environment\n\nFollow all the Processing Tasks in [custom runtimes section](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html)\n\nHandle errors in compilation phase of the Lambda function\n\nSee if Dist::Zilla can build the zip for distributing to Lambda\n\nNotes\n=====\n\nFinding out what you can or can't do inside the Lambda runtime can be exhausting if you do it directly inside Lambda. The `make explore-lambda-environment` target \nruns a shell inside a Docker container that resembles the Lambda runtime environment.\n\nLicense\n=======\n\nThis software is released under an Apache 2.0\n\nCopyright\n=========\n\n(c) 2018 CAPSiDE\n\nAuthor\n======\n\nJose Luis Martinez Torres\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpplu%2Fperl-lambda-byor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpplu%2Fperl-lambda-byor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpplu%2Fperl-lambda-byor/lists"}