Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Read World Serverless

David Schmitz
September 07, 2018
17

Read World Serverless

David Schmitz

September 07, 2018
Tweet

Transcript

  1. @Koenighotze #Voxxed –Me “Some of the things we learned, while

    moving an application (partially) to AWS Lambda.”
  2. @Koenighotze #Voxxed Serverless computing allows you to build and run

    applications and services without thinking about servers. Serverless applications don't require you to provision, scale, and manage any servers… Building serverless applications means that your developers can focus on their core product instead of worrying about managing and operating servers or runtimes…
  3. @Koenighotze #Voxxed Serverless computing allows you to build and run

    applications and services without thinking about servers. Serverless applications don't require you to provision, scale, and manage any servers… Building serverless applications means that your developers can focus on their core product instead of worrying about managing and operating servers or runtimes…
  4. @Koenighotze #Voxxed Create Order ZIP Forward Order ZIP Cancel Order

    ZIP cancel Order forward Order create Order
  5. @Koenighotze #Voxxed $ aws lambda create-function \ --function-name HelloWorld \

    --runtime nodejs6.10 \ --role arn:aws:iam::…:… \ --handler index.handler \ --zip-file fileb://index.zip
  6. @Koenighotze #Voxxed $ aws lambda create-function \ --function-name HelloWorld \

    --runtime nodejs6.10 \ --role arn:aws:iam::…:… \ --handler index.handler \ --zip-file fileb://index.zip
  7. @Koenighotze #Voxxed AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Hello World Resources:

    HelloWorld: Type: AWS::Serverless::Function Properties: Timeout: 5 Runtime: nodejs6.10 Handler: index.handler CodeUri: .
  8. @Koenighotze #Voxxed AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Hello World Resources:

    HelloWorld: Type: AWS::Serverless::Function Properties: Timeout: 5 Runtime: nodejs6.10 Handler: index.handler CodeUri: .
  9. @Koenighotze #Voxxed AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Hello World Resources:

    HelloWorld: Type: AWS::Serverless::Function Properties: Timeout: 5 Runtime: nodejs6.10 Handler: index.handler CodeUri: .
  10. @Koenighotze #Voxxed aws lambda invoke \ --function-name ReceiptUpload \ --region

    eu-central-1 \ --payload file://expensive_receipt.json \ out.json
  11. @Koenighotze #Voxxed aws lambda invoke \ --function-name ReceiptUpload \ --region

    eu-central-1 \ --payload file://expensive_receipt.json \ out.json
  12. @Koenighotze #Voxxed aws lambda invoke \ --function-name ReceiptUpload \ --region

    eu-central-1 \ --payload file://expensive_receipt.json \ out.json
  13. @Koenighotze #Voxxed Parameters: … Stage: Type: String Default: DEV ForwardBilling:

    Type: AWS::Serverless::Function Properties: FunctionName: !Sub ForwardBilling-${Stage}
  14. @Koenighotze #Voxxed Parameters: … Stage: Type: String Default: DEV ForwardBilling:

    Type: AWS::Serverless::Function Properties: FunctionName: !Sub ForwardBilling-${Stage}
  15. @Koenighotze #Voxxed HOW DO YOU DEPLOY A WEB APPLICATION FIREWALL…

    …WITHOUT A WEB …WITHOUT AN APPLICATION …WITHOUT A SERVER
  16. @Koenighotze #Voxxed "Statement": [{ "Effect": "Allow", "Action": [ “s3:*", ],

    "Resource": [ “arn:aws:s3:::senacor/fis/orders/*” ] }, …
  17. @Koenighotze #Voxxed "Statement": [{ "Effect": "Allow", "Action": [ "s3:GetObject" ],

    "Resource": [ “arn:aws:s3:::senacor/fis/orders/*” ] }, …
  18. @Koenighotze #Voxxed "Statement": [{ "Effect": "Allow", "Action": [ "s3:GetObject" ],

    "Resource": [ “arn:aws:s3:::senacor/fis/orders/*” ] }, …
  19. @Koenighotze #Voxxed Resources: ForwardBillingRole: Type: "AWS::IAM::Role" Properties: RoleName: !Sub "ForwardBillingRole-${Stage}"

    AssumeRolePolicyDocument: ... ManagedPolicyArns: ... Policies: - PolicyName: !Sub "StoreBillingInS3Policy-${Stage}" PolicyDocument: ... ForwardBilling: Type: AWS::Serverless::Function Properties: Role: !GetAtt ForwardBillingRole.Arn
  20. @Koenighotze #Voxxed Resources: ForwardBillingRole: Type: "AWS::IAM::Role" Properties: RoleName: !Sub "ForwardBillingRole-${Stage}"

    AssumeRolePolicyDocument: ... ManagedPolicyArns: ... Policies: - PolicyName: !Sub "StoreBillingInS3Policy-${Stage}" PolicyDocument: ... ForwardBilling: Type: AWS::Serverless::Function Properties: Role: !GetAtt ForwardBillingRole.Arn
  21. @Koenighotze #Voxxed Resources: ForwardBillingRole: Type: "AWS::IAM::Role" Properties: RoleName: !Sub "ForwardBillingRole-${Stage}"

    AssumeRolePolicyDocument: ... ManagedPolicyArns: ... Policies: - PolicyName: !Sub "StoreBillingInS3Policy-${Stage}" PolicyDocument: ... ForwardBilling: Type: AWS::Serverless::Function Properties: Role: !GetAtt ForwardBillingRole.Arn
  22. @Koenighotze #Voxxed Resources: ForwardBillingRole: Type: "AWS::IAM::Role" Properties: RoleName: !Sub "ForwardBillingRole-${Stage}"

    AssumeRolePolicyDocument: ... ManagedPolicyArns: ... Policies: - PolicyName: !Sub "StoreBillingInS3Policy-${Stage}" PolicyDocument: ... ForwardBilling: Type: AWS::Serverless::Function Properties: Role: !GetAtt ForwardBillingRole.Arn
  23. @Koenighotze #Voxxed $ du -s src/ 8.0K src/ $ ls

    -lh lambda.zip 7.6M Mar 1 07:13 lambda.zip
  24. @Koenighotze #Voxxed $ du -s src/ 8.0K src/ $ ls

    -lh lambda.zip 7.6M Mar 1 07:13 lambda.zip