Perl and Amazon Web Services

Søren Lund
Søren LundIT Professional at KeyCore
Perl and Amazon Web
Services
London Perl Workshop 2019
1
Introduction
In this talk I will
● give a very short introduction to cloud computing in general
● introduce a few AWS resources (CloudFormation, EC2, S3, Lambda)
● demonstrate running Perl on an EC2 instance
● demonstrate using AWS::Lambda to create a Perl runtime for AWS Lambda
2
But, first
About me:
● My name is Søren Lund and I’m from Denmark
● I’ve been a SW developer for more than twenty years
● I’ve used many programming languages (C/C++, Perl, Java, JavaScript, …)
● I’ve also worked a lot with build automation, CI/CD and automated tests
● I’ve worked as a AWS consultant for the last couple of years
3
Disclaimer
● I’ve no experience running Perl on AWS!
However,
● I know Perl
● I know AWS
Or, as the meme goes
● “Trust Me, I’m an Engineer”
4
Cloud Computing
5
Cloud Computing
“Cloud computing is the on-demand availability of computer system
resources, especially data storage and computing power, without direct active
management by the user.”
“Cloud computing was popularized with Amazon.com releasing its Elastic
Compute Cloud product in 2006.”
From https://en.wikipedia.org/wiki/Cloud_computing
6
Service Models
● Infrastructure as a service (IaaS)
● Platform as a service (PaaS)
● Software as a service (SaaS)
● Serverless computing
● Function as a service (FaaS)
7
Infrastructure as a service (IaaS)
“...online services that provide high-level APIs used to dereference various low-
level details of underlying network infrastructure like physical computing
resources, location, data partitioning, scaling, security, backup etc.”
From https://en.wikipedia.org/wiki/Infrastructure_as_a_service
8
Function as a service (FaaS)
“...category of cloud computing services that provides a platform allowing
customers to develop, run, and manage application functionalities without the
complexity of building and maintaining the infrastructure typically associated with
developing and launching an app.”
From https://en.wikipedia.org/wiki/Function_as_a_service
9
Amazon Web Services
10
Amazon Web Service (AWS)
● From 2000 to 2005 Amazon.com works on infrastructure
● AWS is launched on March 19 2006, first service is Amazon S3 (Simple
Storage Service)
● Amazon SQS (Simple Queue Service) follows on July 13
● And on August 25 Amazon EC2 (Elastic Compute Cloud) is launched
From https://en.wikipedia.org/wiki/Timeline_of_Amazon_Web_Services
11
AWS now has many more services
“...137 top level services spread across 23 categories… many of these top level
services further expand into multiple sub services” (January 2019)
From https://www.quora.com/How-many-AWS-services-are-there
See https://aws.amazon.com/products/
12
Getting started with AWS
Sign up at https://aws.amazon.com/
Free tier: https://aws.amazon.com/free/
● Always free - e.g. 1 million free requests on AWS Lambda every month
● 12 month free - e.g. 750 hours EC2 t2.micro instance usage every month
● Trials - e.g. 250 device minutes on AWS Device Farm
13
AWS Management Console
From the “Console” you can create/modify/maintain/destroy resources.
See https://console.aws.amazon.com/console/home
14
Launching an EC2 instance from the Console
15
AWS CLI
The AWS CLI is a uber command “aws”, that can be used to manage your AWS
resources and services.
● Written in Python (pip install awscli)
● Enables you to write scripts that creates/modifies/maintains/destroys
resources
● You need to create credentials (tokens) in the Console to use the CLI
See https://aws.amazon.com/cli/
16
AWS SDKs
Official SDKs providing APIs for AWS services are available in
● JavaScript
● Python
● PHP
● .NET
● Ruby
● Java
● Go
● Node.js
● C++
See https://aws.amazon.com/tools/
Image by Jonny
Lindner from Pixabay
?
17
Paws
● Perl SDK for AWS
● Built by automatically converting Python code into Perl code
● Also includes CLI (paws)
● https://metacpan.org/pod/Paws
18
Image by Jonny
Lindner from Pixabay
❤
AWS CloudFormation
● Infrastructure as code
● Define resources in templates (JSON or YAML) or visual designer
● Deploy template using CloudFormation using the Consol, CLI or API
● A deployed template is called a Stack
19
Basic Anatomy of a CloudFormation Template
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "",
"Parameters" : { },
"Resources" : { },
"Outputs" : { }
}
See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html
20
Running Perl on an EC2 instance
21
Creating a CloudFormation Templates
AWS has lots of examples and snippets.
● Examples: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-sample-templates.html
● Snippets: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/CHAP_TemplateQuickRef.html
There’s also a linter for CloudFormation Templates:
● See https://github.com/aws-cloudformation/cfn-python-lint
22
Amazon EC2
● EC2 provides generic computer virtualization
● When using EC2 you will boot an Amazon Machine Image (AMI) to create a
running machine, called an instance
● Amazon maintains an AMI called Amazon Linux based on CentOS
○ version 1 has Perl 5.16.3
○ version 2 has no Perl
● Run it locally: docker run -it amazonlinux bash
23
User Data in EC2 CloudFormation templates
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"", [
"#!/bin/bashn",
"curl -L http://cpanmin.us | perl - --self-upgraden",
"cpanm Acme::Be::Modernn"
]]
}
}
24
Demo time
Code is available on GitHub.
See https://github.com/soren/perl-and-aws
25
AWS::Lambda
26
AWS Lambda
“...an event-driven, serverless computing platform provided by Amazon as a part
of the Amazon Web Services. It is a computing service that runs code in response
to events and automatically manages the computing resources required by that
code. It was introduced in November 2014.”
From https://en.wikipedia.org/wiki/AWS_Lambda
27
Console demo
28
Using the AWS Lambda runtime provided by
● https://metacpan.org/pod/AWS::Lambda
To execute the following:
sub handle {
my ($payload, $context) = @_;
my $result = encode_json("Hello from Perl!");
return +{ statusCode => 200, body => $result };
}
The End… Questions?
29
1 of 29

Recommended

Designing for elasticity on AWS - 9.11.2015 by
Designing for elasticity on AWS - 9.11.2015Designing for elasticity on AWS - 9.11.2015
Designing for elasticity on AWS - 9.11.2015Anton Babenko
487 views25 slides
Real World AWS Deployment With Boto, Fabric, and Cloud Formation by
Real World AWS Deployment With Boto, Fabric, and Cloud FormationReal World AWS Deployment With Boto, Fabric, and Cloud Formation
Real World AWS Deployment With Boto, Fabric, and Cloud FormationDixon Whitmire
9.1K views22 slides
Advanced Discussion on Cloud Formation by
Advanced Discussion on Cloud FormationAdvanced Discussion on Cloud Formation
Advanced Discussion on Cloud FormationHenry Huang
1.2K views29 slides
Cloud Formation by
Cloud FormationCloud Formation
Cloud FormationTO THE NEW | Technology
2.3K views23 slides
AWS Cloud Formation by
AWS Cloud FormationAWS Cloud Formation
AWS Cloud FormationAmit Thakkar
547 views25 slides
Amazon ECS (December 2015) by
Amazon ECS (December 2015)Amazon ECS (December 2015)
Amazon ECS (December 2015)Julien SIMON
2.4K views25 slides

More Related Content

What's hot

Amazon ECS (March 2016) by
Amazon ECS (March 2016)Amazon ECS (March 2016)
Amazon ECS (March 2016)Julien SIMON
18.1K views26 slides
Docker Paris #29 by
Docker Paris #29Docker Paris #29
Docker Paris #29Julien SIMON
1.7K views7 slides
Scaling your web app horizontally and vertically (ahmedabad amazon aws cloud... by
Scaling your web app  horizontally and vertically (ahmedabad amazon aws cloud...Scaling your web app  horizontally and vertically (ahmedabad amazon aws cloud...
Scaling your web app horizontally and vertically (ahmedabad amazon aws cloud...Jhalak Modi
1.2K views14 slides
AWS CodeDeploy - basic intro by
AWS CodeDeploy - basic introAWS CodeDeploy - basic intro
AWS CodeDeploy - basic introAnton Babenko
434 views13 slides
Meeyup aws-loadbalancing-28032015 by
Meeyup aws-loadbalancing-28032015Meeyup aws-loadbalancing-28032015
Meeyup aws-loadbalancing-28032015Jhalak Modi
683 views24 slides
Building serverless apps with Node.js by
Building serverless apps with Node.jsBuilding serverless apps with Node.js
Building serverless apps with Node.jsJulien SIMON
1.1K views22 slides

What's hot(20)

Amazon ECS (March 2016) by Julien SIMON
Amazon ECS (March 2016)Amazon ECS (March 2016)
Amazon ECS (March 2016)
Julien SIMON18.1K views
Scaling your web app horizontally and vertically (ahmedabad amazon aws cloud... by Jhalak Modi
Scaling your web app  horizontally and vertically (ahmedabad amazon aws cloud...Scaling your web app  horizontally and vertically (ahmedabad amazon aws cloud...
Scaling your web app horizontally and vertically (ahmedabad amazon aws cloud...
Jhalak Modi1.2K views
AWS CodeDeploy - basic intro by Anton Babenko
AWS CodeDeploy - basic introAWS CodeDeploy - basic intro
AWS CodeDeploy - basic intro
Anton Babenko434 views
Meeyup aws-loadbalancing-28032015 by Jhalak Modi
Meeyup aws-loadbalancing-28032015Meeyup aws-loadbalancing-28032015
Meeyup aws-loadbalancing-28032015
Jhalak Modi683 views
Building serverless apps with Node.js by Julien SIMON
Building serverless apps with Node.jsBuilding serverless apps with Node.js
Building serverless apps with Node.js
Julien SIMON1.1K views
Building A Dynamic Website - 31st Jan 2015 by Jhalak Modi
Building A Dynamic Website - 31st Jan 2015Building A Dynamic Website - 31st Jan 2015
Building A Dynamic Website - 31st Jan 2015
Jhalak Modi867 views
How to copy multiple files from local to aws s3 bucket using aws cli by Katy Slemon
How to copy multiple files from local to aws s3 bucket using aws cliHow to copy multiple files from local to aws s3 bucket using aws cli
How to copy multiple files from local to aws s3 bucket using aws cli
Katy Slemon258 views
Aws meetup building_lambda by Adam Book
Aws meetup building_lambdaAws meetup building_lambda
Aws meetup building_lambda
Adam Book533 views
Deploying a simple Rails application with AWS Elastic Beanstalk by Julien SIMON
Deploying a simple Rails application with AWS Elastic BeanstalkDeploying a simple Rails application with AWS Elastic Beanstalk
Deploying a simple Rails application with AWS Elastic Beanstalk
Julien SIMON6.9K views
20190406 LT(笹亀) by ssuseraa32c9
20190406 LT(笹亀)20190406 LT(笹亀)
20190406 LT(笹亀)
ssuseraa32c969 views
Continuous delivery in AWS by Anton Babenko
Continuous delivery in AWSContinuous delivery in AWS
Continuous delivery in AWS
Anton Babenko269 views
Artem Zhurbila 5 aws - cloud formation and beanstalk by Artem Zhurbila
Artem Zhurbila 5 aws - cloud formation and beanstalkArtem Zhurbila 5 aws - cloud formation and beanstalk
Artem Zhurbila 5 aws - cloud formation and beanstalk
Artem Zhurbila1.2K views
Cloud Academy's AWS Hands on-labs by Alex Casalboni
Cloud Academy's AWS Hands on-labsCloud Academy's AWS Hands on-labs
Cloud Academy's AWS Hands on-labs
Alex Casalboni401 views
What is AWS lambda? by Whizlabs
What is AWS lambda?What is AWS lambda?
What is AWS lambda?
Whizlabs74 views
Introduction to the Serverless paradigm by Alex Casalboni
Introduction to the Serverless paradigmIntroduction to the Serverless paradigm
Introduction to the Serverless paradigm
Alex Casalboni806 views

Similar to Perl and Amazon Web Services

A 60-mn tour of AWS compute (March 2016) by
A 60-mn tour of AWS compute (March 2016)A 60-mn tour of AWS compute (March 2016)
A 60-mn tour of AWS compute (March 2016)Julien SIMON
2.1K views27 slides
Managing AWS infrastructure using CloudFormation by
Managing AWS infrastructure using CloudFormationManaging AWS infrastructure using CloudFormation
Managing AWS infrastructure using CloudFormationAnton Babenko
1.7K views29 slides
Aws training banglore 13 by
Aws training banglore 13Aws training banglore 13
Aws training banglore 13AshishApponix
23 views6 slides
Aws training banglore 2 by
Aws training banglore 2Aws training banglore 2
Aws training banglore 2AshishApponix
10 views6 slides
Serverless Frameworks on AWS by
Serverless Frameworks on AWSServerless Frameworks on AWS
Serverless Frameworks on AWSJulien SIMON
1.9K views30 slides
Aws training banglore 8 by
Aws training banglore 8Aws training banglore 8
Aws training banglore 8AshishApponix
62 views6 slides

Similar to Perl and Amazon Web Services(20)

A 60-mn tour of AWS compute (March 2016) by Julien SIMON
A 60-mn tour of AWS compute (March 2016)A 60-mn tour of AWS compute (March 2016)
A 60-mn tour of AWS compute (March 2016)
Julien SIMON2.1K views
Managing AWS infrastructure using CloudFormation by Anton Babenko
Managing AWS infrastructure using CloudFormationManaging AWS infrastructure using CloudFormation
Managing AWS infrastructure using CloudFormation
Anton Babenko1.7K views
Serverless Frameworks on AWS by Julien SIMON
Serverless Frameworks on AWSServerless Frameworks on AWS
Serverless Frameworks on AWS
Julien SIMON1.9K views
"Automating AWS Infrastructure with PowerShell", Martin Beeby, AWS Dev Day Ky... by Provectus
"Automating AWS Infrastructure with PowerShell", Martin Beeby, AWS Dev Day Ky..."Automating AWS Infrastructure with PowerShell", Martin Beeby, AWS Dev Day Ky...
"Automating AWS Infrastructure with PowerShell", Martin Beeby, AWS Dev Day Ky...
Provectus261 views
Aws training banglore 15 by AshishApponix
Aws training banglore 15Aws training banglore 15
Aws training banglore 15
AshishApponix125 views
AWS architect certification course by wiTTyMinds1
AWS architect certification course AWS architect certification course
AWS architect certification course
wiTTyMinds195 views
Architetture Serverless: concentrarsi sull'idea, non sull'infrastruttura by Amazon Web Services
Architetture Serverless: concentrarsi sull'idea, non sull'infrastrutturaArchitetture Serverless: concentrarsi sull'idea, non sull'infrastruttura
Architetture Serverless: concentrarsi sull'idea, non sull'infrastruttura
Amazon Web Services1.8K views
Serverless Optical Character Recognition in support of Astronaut Safety AWS M... by Chris Shenton
Serverless Optical Character Recognition in support of Astronaut Safety AWS M...Serverless Optical Character Recognition in support of Astronaut Safety AWS M...
Serverless Optical Character Recognition in support of Astronaut Safety AWS M...
Chris Shenton235 views

More from Søren Lund

Documenting code yapceu2016 by
Documenting code yapceu2016Documenting code yapceu2016
Documenting code yapceu2016Søren Lund
363 views31 slides
Documenting Code - Patterns and Anti-patterns - NLPW 2016 by
Documenting Code - Patterns and Anti-patterns - NLPW 2016Documenting Code - Patterns and Anti-patterns - NLPW 2016
Documenting Code - Patterns and Anti-patterns - NLPW 2016Søren Lund
535 views30 slides
Beyond Unit Testing by
Beyond Unit TestingBeyond Unit Testing
Beyond Unit TestingSøren Lund
708 views10 slides
Playing with Hadoop (NPW2013) by
Playing with Hadoop (NPW2013)Playing with Hadoop (NPW2013)
Playing with Hadoop (NPW2013)Søren Lund
1.1K views60 slides
Playing with Hadoop 2013-10-31 by
Playing with Hadoop 2013-10-31Playing with Hadoop 2013-10-31
Playing with Hadoop 2013-10-31Søren Lund
715 views35 slides
Apache JMeter Introduction by
Apache JMeter IntroductionApache JMeter Introduction
Apache JMeter IntroductionSøren Lund
691 views10 slides

More from Søren Lund(8)

Documenting code yapceu2016 by Søren Lund
Documenting code yapceu2016Documenting code yapceu2016
Documenting code yapceu2016
Søren Lund363 views
Documenting Code - Patterns and Anti-patterns - NLPW 2016 by Søren Lund
Documenting Code - Patterns and Anti-patterns - NLPW 2016Documenting Code - Patterns and Anti-patterns - NLPW 2016
Documenting Code - Patterns and Anti-patterns - NLPW 2016
Søren Lund535 views
Beyond Unit Testing by Søren Lund
Beyond Unit TestingBeyond Unit Testing
Beyond Unit Testing
Søren Lund708 views
Playing with Hadoop (NPW2013) by Søren Lund
Playing with Hadoop (NPW2013)Playing with Hadoop (NPW2013)
Playing with Hadoop (NPW2013)
Søren Lund1.1K views
Playing with Hadoop 2013-10-31 by Søren Lund
Playing with Hadoop 2013-10-31Playing with Hadoop 2013-10-31
Playing with Hadoop 2013-10-31
Søren Lund715 views
Apache JMeter Introduction by Søren Lund
Apache JMeter IntroductionApache JMeter Introduction
Apache JMeter Introduction
Søren Lund691 views
Basic testing with selenium by Søren Lund
Basic testing with seleniumBasic testing with selenium
Basic testing with selenium
Søren Lund5.1K views
E-books and App::Pod2Epub by Søren Lund
E-books and App::Pod2EpubE-books and App::Pod2Epub
E-books and App::Pod2Epub
Søren Lund511 views

Recently uploaded

nintendo_64.pptx by
nintendo_64.pptxnintendo_64.pptx
nintendo_64.pptxpaiga02016
7 views7 slides
Supercharging your Python Development Environment with VS Code and Dev Contai... by
Supercharging your Python Development Environment with VS Code and Dev Contai...Supercharging your Python Development Environment with VS Code and Dev Contai...
Supercharging your Python Development Environment with VS Code and Dev Contai...Dawn Wages
5 views51 slides
University of Borås-full talk-2023-12-09.pptx by
University of Borås-full talk-2023-12-09.pptxUniversity of Borås-full talk-2023-12-09.pptx
University of Borås-full talk-2023-12-09.pptxMahdi_Fahmideh
12 views51 slides
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... by
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...NimaTorabi2
17 views17 slides
Techstack Ltd at Slush 2023, Ukrainian delegation by
Techstack Ltd at Slush 2023, Ukrainian delegationTechstack Ltd at Slush 2023, Ukrainian delegation
Techstack Ltd at Slush 2023, Ukrainian delegationViktoriiaOpanasenko
7 views4 slides
Google Solutions Challenge 2024 Talk pdf by
Google Solutions Challenge 2024 Talk pdfGoogle Solutions Challenge 2024 Talk pdf
Google Solutions Challenge 2024 Talk pdfMohdAbdulAleem4
34 views17 slides

Recently uploaded(20)

Supercharging your Python Development Environment with VS Code and Dev Contai... by Dawn Wages
Supercharging your Python Development Environment with VS Code and Dev Contai...Supercharging your Python Development Environment with VS Code and Dev Contai...
Supercharging your Python Development Environment with VS Code and Dev Contai...
Dawn Wages5 views
University of Borås-full talk-2023-12-09.pptx by Mahdi_Fahmideh
University of Borås-full talk-2023-12-09.pptxUniversity of Borås-full talk-2023-12-09.pptx
University of Borås-full talk-2023-12-09.pptx
Mahdi_Fahmideh12 views
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... by NimaTorabi2
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
NimaTorabi217 views
Google Solutions Challenge 2024 Talk pdf by MohdAbdulAleem4
Google Solutions Challenge 2024 Talk pdfGoogle Solutions Challenge 2024 Talk pdf
Google Solutions Challenge 2024 Talk pdf
MohdAbdulAleem434 views
Streamlining Your Business Operations with Enterprise Application Integration... by Flexsin
Streamlining Your Business Operations with Enterprise Application Integration...Streamlining Your Business Operations with Enterprise Application Integration...
Streamlining Your Business Operations with Enterprise Application Integration...
Flexsin 5 views
predicting-m3-devopsconMunich-2023.pptx by Tier1 app
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptx
Tier1 app10 views
Electronic AWB - Electronic Air Waybill by Freightoscope
Electronic AWB - Electronic Air Waybill Electronic AWB - Electronic Air Waybill
Electronic AWB - Electronic Air Waybill
Freightoscope 6 views
tecnologia18.docx by nosi6702
tecnologia18.docxtecnologia18.docx
tecnologia18.docx
nosi67026 views
Transport Management System - Shipment & Container Tracking by Freightoscope
Transport Management System - Shipment & Container TrackingTransport Management System - Shipment & Container Tracking
Transport Management System - Shipment & Container Tracking
Freightoscope 6 views
Bootstrapping vs Venture Capital.pptx by Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic16 views
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile... by Stefan Wolpers
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
Stefan Wolpers44 views
Top-5-production-devconMunich-2023-v2.pptx by Tier1 app
Top-5-production-devconMunich-2023-v2.pptxTop-5-production-devconMunich-2023-v2.pptx
Top-5-production-devconMunich-2023-v2.pptx
Tier1 app9 views

Perl and Amazon Web Services

  • 1. Perl and Amazon Web Services London Perl Workshop 2019 1
  • 2. Introduction In this talk I will ● give a very short introduction to cloud computing in general ● introduce a few AWS resources (CloudFormation, EC2, S3, Lambda) ● demonstrate running Perl on an EC2 instance ● demonstrate using AWS::Lambda to create a Perl runtime for AWS Lambda 2
  • 3. But, first About me: ● My name is Søren Lund and I’m from Denmark ● I’ve been a SW developer for more than twenty years ● I’ve used many programming languages (C/C++, Perl, Java, JavaScript, …) ● I’ve also worked a lot with build automation, CI/CD and automated tests ● I’ve worked as a AWS consultant for the last couple of years 3
  • 4. Disclaimer ● I’ve no experience running Perl on AWS! However, ● I know Perl ● I know AWS Or, as the meme goes ● “Trust Me, I’m an Engineer” 4
  • 6. Cloud Computing “Cloud computing is the on-demand availability of computer system resources, especially data storage and computing power, without direct active management by the user.” “Cloud computing was popularized with Amazon.com releasing its Elastic Compute Cloud product in 2006.” From https://en.wikipedia.org/wiki/Cloud_computing 6
  • 7. Service Models ● Infrastructure as a service (IaaS) ● Platform as a service (PaaS) ● Software as a service (SaaS) ● Serverless computing ● Function as a service (FaaS) 7
  • 8. Infrastructure as a service (IaaS) “...online services that provide high-level APIs used to dereference various low- level details of underlying network infrastructure like physical computing resources, location, data partitioning, scaling, security, backup etc.” From https://en.wikipedia.org/wiki/Infrastructure_as_a_service 8
  • 9. Function as a service (FaaS) “...category of cloud computing services that provides a platform allowing customers to develop, run, and manage application functionalities without the complexity of building and maintaining the infrastructure typically associated with developing and launching an app.” From https://en.wikipedia.org/wiki/Function_as_a_service 9
  • 11. Amazon Web Service (AWS) ● From 2000 to 2005 Amazon.com works on infrastructure ● AWS is launched on March 19 2006, first service is Amazon S3 (Simple Storage Service) ● Amazon SQS (Simple Queue Service) follows on July 13 ● And on August 25 Amazon EC2 (Elastic Compute Cloud) is launched From https://en.wikipedia.org/wiki/Timeline_of_Amazon_Web_Services 11
  • 12. AWS now has many more services “...137 top level services spread across 23 categories… many of these top level services further expand into multiple sub services” (January 2019) From https://www.quora.com/How-many-AWS-services-are-there See https://aws.amazon.com/products/ 12
  • 13. Getting started with AWS Sign up at https://aws.amazon.com/ Free tier: https://aws.amazon.com/free/ ● Always free - e.g. 1 million free requests on AWS Lambda every month ● 12 month free - e.g. 750 hours EC2 t2.micro instance usage every month ● Trials - e.g. 250 device minutes on AWS Device Farm 13
  • 14. AWS Management Console From the “Console” you can create/modify/maintain/destroy resources. See https://console.aws.amazon.com/console/home 14
  • 15. Launching an EC2 instance from the Console 15
  • 16. AWS CLI The AWS CLI is a uber command “aws”, that can be used to manage your AWS resources and services. ● Written in Python (pip install awscli) ● Enables you to write scripts that creates/modifies/maintains/destroys resources ● You need to create credentials (tokens) in the Console to use the CLI See https://aws.amazon.com/cli/ 16
  • 17. AWS SDKs Official SDKs providing APIs for AWS services are available in ● JavaScript ● Python ● PHP ● .NET ● Ruby ● Java ● Go ● Node.js ● C++ See https://aws.amazon.com/tools/ Image by Jonny Lindner from Pixabay ? 17
  • 18. Paws ● Perl SDK for AWS ● Built by automatically converting Python code into Perl code ● Also includes CLI (paws) ● https://metacpan.org/pod/Paws 18 Image by Jonny Lindner from Pixabay ❤
  • 19. AWS CloudFormation ● Infrastructure as code ● Define resources in templates (JSON or YAML) or visual designer ● Deploy template using CloudFormation using the Consol, CLI or API ● A deployed template is called a Stack 19
  • 20. Basic Anatomy of a CloudFormation Template { "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "", "Parameters" : { }, "Resources" : { }, "Outputs" : { } } See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html 20
  • 21. Running Perl on an EC2 instance 21
  • 22. Creating a CloudFormation Templates AWS has lots of examples and snippets. ● Examples: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-sample-templates.html ● Snippets: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/CHAP_TemplateQuickRef.html There’s also a linter for CloudFormation Templates: ● See https://github.com/aws-cloudformation/cfn-python-lint 22
  • 23. Amazon EC2 ● EC2 provides generic computer virtualization ● When using EC2 you will boot an Amazon Machine Image (AMI) to create a running machine, called an instance ● Amazon maintains an AMI called Amazon Linux based on CentOS ○ version 1 has Perl 5.16.3 ○ version 2 has no Perl ● Run it locally: docker run -it amazonlinux bash 23
  • 24. User Data in EC2 CloudFormation templates "UserData": { "Fn::Base64": { "Fn::Join": [ "", [ "#!/bin/bashn", "curl -L http://cpanmin.us | perl - --self-upgraden", "cpanm Acme::Be::Modernn" ]] } } 24
  • 25. Demo time Code is available on GitHub. See https://github.com/soren/perl-and-aws 25
  • 27. AWS Lambda “...an event-driven, serverless computing platform provided by Amazon as a part of the Amazon Web Services. It is a computing service that runs code in response to events and automatically manages the computing resources required by that code. It was introduced in November 2014.” From https://en.wikipedia.org/wiki/AWS_Lambda 27
  • 28. Console demo 28 Using the AWS Lambda runtime provided by ● https://metacpan.org/pod/AWS::Lambda To execute the following: sub handle { my ($payload, $context) = @_; my $result = encode_json("Hello from Perl!"); return +{ statusCode => 200, body => $result }; }