Perl meets AWS Lambda

672ee2598bea695496f11022a9a9c4c8?s=47 moznion
January 26, 2019

Perl meets AWS Lambda

This slide is for YAPC::Tokyo 2019 LT

672ee2598bea695496f11022a9a9c4c8?s=128

moznion

January 26, 2019
Tweet

Transcript

  1. Perl meets AWS Lambda YAPC::Tokyo 2019 @moznion

  2. None
  3. ͜Ε͸ӕʂʂʂʂ

  4. AWS Lambdaͷ͓࿩

  5. AWS Lambda - ୹͍ϫϯγϣοτͷίϯϐϡʔςΟϯά ϦιʔεΛఏڙ (࠷ۙ͸5෼͔Β15෼ʹ) - αʔόϨεͱ͔ݺ͹ΕͯΔ΍ͭͰ͢ʢࡶʣ

  6. ͍ͭʹAWS LambdaʹΞϨ͕དྷ·ͨ͠Ͷ

  7. ͍ͭʹAWS LambdaʹΞϨ͕དྷ·ͨ͠Ͷ Ruby

  8. YAPCͩͧʂʂʂ

  9. AWS Lambda Layers

  10. AWS Lambda Layers - ೚ҙͷϥϯλΠϜΛLambda্Ͱಈ͔ͤΔ࢓૊Έ - ϥϯλΠϜͱbootstrapΛzipʹΞʔΧΠϒͯ͠ Ξοϓϩʔυ - See

    Also https://docs.aws.amazon.com/lambda/latest/ dg/configuration-layers.html
  11. bootstrap - LayerͷίΞίϯϙʔωϯτ - Lambda FunctionͰLayerΛ༗ޮʹ͢Δͱ
 ͜ͷbootstrap͕ୟ͔ΕΔ

  12. 3. Do function bootstrap bootstrap AWS platform 1. Next Invocation

    API 2. Event 4. Invocation Response/Error
  13. γϯϓϧͰ͢Ͷ

  14. AWS Lambda Layers - ೚ҙͷϥϯλΠϜΛLambda্Ͱಈ͔ͤΔ࢓૊Έ - ϥϯλΠϜͱbootstrapΛzipʹΞʔΧΠϒͯ͠ Ξοϓϩʔυ - See

    Also https://docs.aws.amazon.com/lambda/latest/ dg/configuration-layers.html
  15. AWS Lambda Layers - ೚ҙͷϥϯλΠϜΛLambda্Ͱಈ͔ͤΔ࢓૊Έ - ϥϯλΠϜͱbootstrapΛzipʹΞʔΧΠϒͯ͠ Ξοϓϩʔυ - See

    Also https://docs.aws.amazon.com/lambda/latest/ dg/configuration-layers.html
  16. AWS Lambda Layers - ೚ҙͷϥϯλΠϜΛLambda্Ͱಈ͔ͤΔ࢓૊Έ - ϥϯλΠϜͱbootstrapΛzipʹΞʔΧΠϒͯ͠ Ξοϓϩʔυ - See

    Also https://docs.aws.amazon.com/lambda/latest/ dg/configuration-layers.html Perl
  17. aws-lambda-perl5-layer

  18. Perl Lambda Layer - Repository: https://github.com/moznion/aws- lambda-perl5-layer - Blog: aws-lambda-perl5-layer

    ॻ͍ͨ -
  19. Perl Lambda Layer - Ϟνϕʔγϣϯ - ੜ͖͍ͯΔͱ͍Ζ͍Ζ͋Δ - ஌త޷ح৺ -

    ੜ͖͍ͯΔͱ͍Ζ͍Ζ͋Δ
  20. Perl Lambda Layer - Layerͷ࡞Γํ - bootstrapΛॻ͘ - LambdaͷϕʔεDockerίϯςφʹperlΛΠϯετʔϧ -

    Πϯετʔϧͨ͠PerlϥϯλΠϜͱbootstrapΛzipʹݻΊΔ - Ξοϓϩʔυʂʂ
  21. ؆୯Ͱ͢Ͷ

  22. Perl Lambda Layer - ಛ௃ - carton friendly - ϏϧυࡁΈLayerఏڙ͋Γ

    - arn:aws:lambda:${REGION}:652718333417:layer:perl-5_26-layer:1 - arn:aws:lambda:${REGION}:652718333417:layer:perl-5_28-layer:1 - શAWSϦʔδϣϯαϙʔτ
  23. Perl Lambda Layer - ap-northeast-1 - ap-northeast-2 - ap-south-1 -

    ap-southeast-1 - ap-southeast-2 - ca-central-1 - eu-central-1 - eu-west-1 - eu-west-2 - eu-west-3 - sa-east-1 - us-east-1 - us-east-2 - us-west-1 - us-west-2
  24. Perl Lambda Layer - FunctionͷσϓϩΠํ๏ - (dependencyΛlocalҎԼʹvendoring͢Δ) - σΟϨΫτϦશମΛzipʹ·ͱΊΔ

  25. ؆୯Ͱ͢Ͷʁ

  26. ͍΍ʔΊΜͲ͘Ͷʁ

  27. ͸͍……

  28. ……

  29. App::Perlambda

  30. App::Perlambda - aws-lambda-perl5-layer޲͚ͷϚωδϝϯτ
 CLIπʔϧ - dist, create, updateʹରԠ - https://github.com/moznion/p5-App-Perlambda

  31. DEMO

  32. ·ͱΊ - Ruby͕AWS LambdaʹରԠ͠·ͨ͠ - AWS LambdaʹLayers͕΍͖ͬͯ·ͨ͠ - Perl͕LayerͷྗͰAWS LambdaʹରԠ͠·ͨ͠

    - App::Perlambdaͱ͍͏ˢͷϚωδϝϯτπʔϧ Λॻ͖·ͨ͠
  33. ॴײ - ࣮ࡍLambdaॻ͘ͳΒඇಉظॲཧ͠΍͍͢ݴޠΛ
 બΜͩ΄͏͕͍͍ͱࢥ͏…… - go - node - ͳͲ

    - ͳ͓ fork(2) ͸Ͳ͏΍Βಈ͘……
  34. ͦͷଞ - ศརͦ͏ͳͷ͕ग़ͨ - https://github.com/awslabs/aws-lambda- container-image-converter

  35. ͓ΘΓ