Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Serverless DevOps to the Rescue - SRV330 - re:Invent 2017

685 views

Published on

Join this workshop for a crash course in serverless DevOps! This workshops presents a scenario in which you help out Wild Rydes (www.wildrydes.com), the world’s leading unicorn transportation startup! After building the first iteration of its serverless web application, Wild Rydes needs serverless DevOps experts like yourself to help it rapidly build and iterate upon its web app. In this workshop, you’ll help Wild Rydes set up a CI/CD pipeline that enables the company to rapidly build, test, and deploy changes to its serverless application. You’ll also learn to monitor and diagnose issues for its application. This workshop will teach you how to model and deploy serverless apps with the AWS Serverless Application Model. You’ll learn to use AWS CodePipeline and AWS CodeBuild to create a CI/CD pipeline for AWS Lambda and other services. Finally, you’ll learn to use AWS X-Ray to diagnose issues in your Lambda functions.

Requirements: Laptop, AWS account, basic Git experience. Recommended: Previous experience with the AWS Management Console and AWS CloudFormation templates, some familiarity with the AWS Developer Tools services, and preferably one of the AWS Associate certifications.

  • Be the first to comment

Serverless DevOps to the Rescue - SRV330 - re:Invent 2017

  1. 1. AWS re:Invent Serverless DevOps to the Rescue S a m D e n g l e r A W S S o l u t i o n s A r c h i t e c t N o v e m b e r 2 9 , 2 0 1 7
  2. 2. Agenda • DevOps overview • AWS Code Services • Serverless overview • AWS serverless services • Workshop overview • Get started!
  3. 3. DevOps overview
  4. 4. Software moves faster today
  5. 5. Why does DevOps matter? 30xMore frequent deployments 200xShorter lead times 60xFewer failures 168xFaster recovery
  6. 6. Development transformation at Amazon: 2001–2009 2001 2009 Monolithic architecture and hierarchical organization Decoupled services and two pizza teams
  7. 7. In 2009, we ran a study to find out where inefficiencies might still exist
  8. 8. We were just waiting WaitWrite code WaitBuild code WaitDeploy to test Deploy to prod Weeks Mins Days Mins Days Mins Days Mins
  9. 9. We were just waiting WaitWrite code WaitBuild code WaitDeploy to test Deploy to prod Weeks Mins Days Mins Days Mins Days Mins
  10. 10. Deployment pipelines Automated actions and transitions; from check-in to production Development benefits: • Faster • Safer • Simplification and standardization
  11. 11. This has continued to work out really well In 2014: • Thousands of service teams across Amazon • Building microservices • Practicing continuous delivery • Many environments (staging, beta, production) 50 million deployments a year
  12. 12. Where do you ?
  13. 13. AWS Code Services
  14. 14. AWS Code Services AWS CodePipeline AWS CodeBuildAWS CodeCommit AWS SAM
  15. 15. AWS Code Services Source Build Test Production Third-party tooling Software release steps: AWS CodeCommit AWS CodeBuild AWS CodePipeline AWS SAM
  16. 16. AWS CodeStar Start developing on AWS in minutes Work across your team, securely Manage software delivery easily Choose from a variety of project templates Quickly develop, build, and deploy applications on AWS
  17. 17. AWS CodeStar
  18. 18. Serverless overview
  19. 19. Owning servers means dealing with ... Operations and management Scaling Provisioning and utilization Availability and fault tolerance
  20. 20. Benefits of Lambda and serverless compute No servers to provision or manage Scales with usage Never pay for idle Availability and fault tolerance built in
  21. 21. Using AWS Lambda Bring your own code • Node.js, Java, Python, C# • Bring your own libraries (even native ones) Flexible use • Synchronous or asynchronous • Integrated with other AWS services Flexible authorization • Securely grant access to resources and VPCs • Fine-grained control for invoking your functions Simple resource model • Select power rating from 128 MB to 1.5 GB • CPU and network allocated proportionately
  22. 22. AWS serverless services
  23. 23. Services for building serverless applications AWS SAM AWS Lambda Amazon DynamoDB Amazon API Gateway Amazon SQS Serverless compute and API proxy AWS X-Ray AWS step functions Database, state management, and queues Developer tools
  24. 24. AWS Serverless Application Model (AWS SAM) AWS CloudFormation brings: • Infrastructure as code • Easy to provision and manage a collection of related AWS resources • Input .yaml file and output provisioned AWS resources • Optimized for infrastructure AWS SAM: • CloudFormation extension optimized for serverless • New serverless resources: functions, APIs, and tables • Supports anything CloudFormation supports • Open specification (Apache 2.0)
  25. 25. AWS SAM: Less complexity, more power AWSTemplateFormatVersion: '2010-09-09' Resources: GetHtmlFunctionGetHtmlPermissionProd: Type: AWS::Lambda::Permission Properties: Action: lambda:invokeFunction Principal: apigateway.amazonaws.com FunctionName: Ref: GetHtmlFunction SourceArn: Fn::Sub: arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${ServerlessRestApi}/Prod/ANY/* ServerlessRestApiProdStage: Type: AWS::ApiGateway::Stage Properties: DeploymentId: Ref: ServerlessRestApiDeployment RestApiId: Ref: ServerlessRestApi StageName: Prod ListTable: Type: AWS::DynamoDB::Table Properties: ProvisionedThroughput: WriteCapacityUnits: 5 ReadCapacityUnits: 5 AttributeDefinitions: - AttributeName: id AttributeType: S KeySchema: - KeyType: HASH AttributeName: id GetHtmlFunction: Type: AWS::Lambda::Function Properties: Handler: index.gethtml Code: S3Bucket: flourish-demo-bucket S3Key: todo_list.zip Role: Fn::GetAtt: - GetHtmlFunctionRole - Arn Runtime: nodejs4.3 GetHtmlFunctionRole: Type: AWS::IAM::Role Properties: ManagedPolicyArns: - arn:aws:iam::aws:policy/AmazonDynamoDBReadOnlyAccess - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Action: - sts:AssumeRole Effect: Allow Principal: Service: - lambda.amazonaws.com ServerlessRestApiDeployment: Type: AWS::ApiGateway::Deployment Properties: RestApiId: Ref: ServerlessRestApi Description: 'RestApi deployment id: 127e3fb91142ab1ddc5f5446adb094442581a90d' StageName: Stage GetHtmlFunctionGetHtmlPermissionTest: Type: AWS::Lambda::Permission Properties: Action: lambda:invokeFunction Principal: apigateway.amazonaws.com FunctionName: Ref: GetHtmlFunction SourceArn: Fn::Sub: arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${ServerlessRestApi}/*/ANY/* ServerlessRestApi: Type: AWS::ApiGateway::RestApi Properties: Body: info: version: '1.0' title: Ref: AWS::StackName paths: "/{proxy+}": x-amazon-apigateway-any-method: x-amazon-apigateway-integration: httpMethod: ANY type: aws_proxy uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03- 31/functions/${GetHtmlFunction.Arn}/invocations responses: {} swagger: '2.0' AWSTemplateFormatVersion: '2010-09-09’ Transform: AWS::Serverless-2016-10-31 Resources: GetHtmlFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://flourish-demo-bucket/todo_list.zip Handler: index.gethtml Runtime: nodejs4.3 Policies: AmazonDynamoDBReadOnlyAccess Events: GetHtml: Type: Api Properties: Path: /{proxy+} Method: ANY ListTable: Type: AWS::Serverless::SimpleTable CF template example—API triggering Lambda AWS SAM example—API triggering Lambda
  26. 26. AWS SAM Local • https://github.com/awslabs/aws-sam-local • Install and run Docker • Install SAM Local (Go platform binaries) • Local functionality • Invoke functions • Generate sample event source payloads • Run API Gateway
  27. 27. Workshop overview
  28. 28. Wild Rydes Unicorn Stable API
  29. 29. Wild Rydes Unicorn Stable API architecture Internet Website / CLI AWS AWS Lambda functions Amazon CloudWatch Monitoring Amazon CloudFront Amazon API Gateway Amazon DynamoDB
  30. 30. Before After Workshop format
  31. 31. Fetch Code Updates git fetch --all git reset --hard origin/master Publish Code Updates git add . git commit –m “description of change” git push origin master Git commands
  32. 32. Workshop modules 1. CodeStar setup 2. Serverless Application Model 3. Continuous delivery 4. AWS X-Ray
  33. 33. Get started! • Work in teams • Reveal detailed instructions, if necessary • AWS staff is here to help • $25 AWS credits will be available • http://amzn.to/serverless-devops-workshop
  34. 34. Thank you!

×