Shogo's Blog

Dec 5, 2023 - 2 minute read - perl aws aws-lambda

Amazon Linux 2023ベースのAWS Lambda Perl Runtimeを公開しました

この記事は、Perl Advent Calendar 2023 5日目の記事です。 4日目は@doikojiで「ChatGPTとperl:古のCGIスクリプトを現代的な環境に合わせて再生させようとした話」でした。


AWS LambdaにAmazon Linux 2023ベースのカスタムランタイムが追加されました。 これはつまり・・・

ということでPerlをビルドしました。

使い方はPerl Hackers Hubをどうぞ。

ビルド済み公開 Perl Runtime Layer

いつも通りビルド済みのレイヤーを公開しています。

  • x86_64 architecture
    • arn:aws:lambda:af-south-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:ap-east-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:ap-northeast-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:ap-northeast-2:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:ap-northeast-3:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:ap-south-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:ap-south-2:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:ap-southeast-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:ap-southeast-2:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:ap-southeast-3:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:ap-southeast-4:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:ca-central-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:eu-central-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:eu-central-2:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:eu-north-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:eu-south-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:eu-south-2:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:eu-west-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:eu-west-2:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:eu-west-3:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:il-central-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:me-central-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:me-south-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:sa-east-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:us-east-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:us-east-2:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:us-west-1:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
    • arn:aws:lambda:us-west-2:445285296882:layer:perl-5-38-runtime-al2023-x86_64:2
  • arm64 architecture
    • arn:aws:lambda:af-south-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:ap-east-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:ap-northeast-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:ap-northeast-2:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:ap-northeast-3:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:ap-south-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:ap-south-2:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:ap-southeast-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:ap-southeast-2:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:ap-southeast-3:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:ap-southeast-4:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:ca-central-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:eu-central-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:eu-central-2:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:eu-north-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:eu-south-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:eu-south-2:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:eu-west-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:eu-west-2:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:eu-west-3:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:il-central-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:me-central-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:me-south-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:sa-east-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:us-east-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:us-east-2:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:us-west-1:445285296882:layer:perl-5-38-runtime-al2023-arm64:2
    • arn:aws:lambda:us-west-2:445285296882:layer:perl-5-38-runtime-al2023-arm64:2

ビルド済み公開 Paws Layer

  • x86_64 architecture
    • arn:aws:lambda:af-south-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:ap-east-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:ap-northeast-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:ap-northeast-2:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:ap-northeast-3:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:ap-south-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:ap-south-2:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:ap-southeast-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:ap-southeast-2:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:ap-southeast-3:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:ap-southeast-4:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:ca-central-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:eu-central-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:eu-central-2:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:eu-north-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:eu-south-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:eu-south-2:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:eu-west-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:eu-west-2:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:eu-west-3:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:il-central-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:me-central-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:me-south-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:sa-east-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:us-east-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:us-east-2:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:us-west-1:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
    • arn:aws:lambda:us-west-2:445285296882:layer:perl-5-38-runtime-paws-x86_64:3
  • arm64 architecture
    • arn:aws:lambda:af-south-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:ap-east-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:ap-northeast-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:ap-northeast-2:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:ap-northeast-3:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:ap-south-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:ap-south-2:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:ap-southeast-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:ap-southeast-2:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:ap-southeast-3:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:ap-southeast-4:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:ca-central-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:eu-central-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:eu-central-2:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:eu-north-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:eu-south-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:eu-south-2:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:eu-west-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:eu-west-2:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:eu-west-3:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:il-central-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:me-central-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:me-south-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:sa-east-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:us-east-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:us-east-2:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:us-west-1:445285296882:layer:perl-5-38-runtime-paws-arm64:1
    • arn:aws:lambda:us-west-2:445285296882:layer:perl-5-38-runtime-paws-arm64:1

al2023の注意点

詳細は公式のアナウンスを確認してほしいのですが、al2023ランタイムを使うに当たっていくつか注意点があります。

まずはパッケージ管理が microdnf で行われていること。 通常のAmazon Linux 2023 では、パッケージ管理は yum から後継の dnf に切り替わりました。 AWS Runtimeではさらに容量を削減するために dnf の軽量版である microdnf を利用しているそうです。 これによりPythonへの依存がなくなり、軽量になったとのこと。 その分 dnf コマンドの機能がいくつか機能が削減されています。

あとはtzdataが未インストールなこと(同僚がGoのデプロイでハマっていた)。 日時を扱うようなプログラムを書く場合は注意してください。


明日6日目はid:papixで「MySQLのDATETIMEをとにかく素早くPerlのDateTimeオブジェクトにしたい」です。 お楽しみに!

参考