Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming the Cloud: Empowering Developers to Do Infrastructure

Similar presentations


Presentation on theme: "Programming the Cloud: Empowering Developers to Do Infrastructure"— Presentation transcript:

1 Programming the Cloud: Empowering Developers to Do Infrastructure
Luke Hoban QCON San Francisco November 11th, 2019 Welcome everyone to the last session of QCON London. My name is Luke Hoban, and I’m here today to talk about Programming the Cloud. ---- I have three goals today: Convince you that we can and should treat the Cloud as a truly programmable platform, and apply the same software engineering practices to it that we do in our application software. Show you in practice what this can look like using one of the open source tools that is leading the way on this - Pulumi.

2 Why do I care about this? So - why do I care about empowering developers to harness the power of cloud infrastructure? My interest in this topic is born in part from my experience working on developer tools and cloud infrastructure. On the developer tools side, I co-founded the TypeScript project and helped incubate VS Code at Microsoft, and was part of TC39 - the JavaScript standards group. On the cloud side, I worked on EC2 at AWS and am currently the CTO at a startup called Pulumi which builds an open-source project for programming the cloud which I’ll talk about a bit later in the talk. I had two takeaways from my experience across theses areas: The tools, frameworks, langauges and software engineering practices we’ve developers as an industry over the last 30 years have been critical part of being able to scale up the complexity of applications we build today The building block services provided by the cluod providers are incredible, and offer economic benefits and flexibility that are transforming every part of the software industry Yet the tools and engineering practies around cloud infrastructure are, frankly, extremely primitive.

3 An Analogy What’s missing? Variables Loops Functions Abstraction
Standard Library Types To give an analogy - 40 years ago, the state of the art for application development was assembly code. This didn’t feel too bad - it enabled experts to build software using microprocessors! But as we look back on this - we see a bunch of key things missing! What it took to bring all these to bear was the creation of C. And over the following decades, Basic, Java, Python, etc.

4 Software Engineering Desiderata
Application Frameworks High-Level Languages Type Checking IDEs Unit Testing Rapid Iteration Debugging CI/CD Source Control Package Management Componentization Integration Testing

5 Infrastructure as Code
You may be thinking - isn’t that what Infrastructure as Code is all about? Well, yes and no.

6

7 Infrastructure as Code Text

8 Infrastructure as Code for Developers
Demo Infrastructure as Code for Developers Bucket Packages IDE For loops Exports AWS Console Making a change and updating Stacks

9

10

11

12 Fundamentally Stateful
Process Models web server cloud Page Transient Script tags Stateless Process Finite lifetime ELF binaries Largely stateless Stack Lives “forever” Desired State Fundamentally Stateful

13 Application vs. Infrastructure

14 Application + Infrastructure
Desired State: There is a Fargate Task It has 512MB memory reservation It is running the Docker image built from ./docker-ffmpeg-thumb

15 Application + Infrastructure

16 Unifying Application and Infrastructure
Demo Unifying Application and Infrastructure

17 Transition to Cloud Native
Pre-Cloud Cloud Native Lambda S3 API Gateway MySQL Docker PM2 DataDog EKS CloudWatch DataDog Aurora Before: A few VMs which run services, a pipeline for delivering changes to them. After: Many managed services wired together.

18 Programming Architecture Diagrams

19 Programming Architecture Diagrams
Demo Programming Architecture Diagrams

20 Architecture as Code

21

22 Building a Cloud App in 90 Seconds
Demo Building a Cloud App in 90 Seconds

23 The Future? Frameworks on top of cloud provider building blocks Unifying application and infrastructure A process model native to the cloud Rapidly develop directly in the cloud “Every Developer Is a Cloud Developer”

24 Thanks! Program the Cloud @lukehoban lukehoban

25 An Analogy What’s missing? Variables Loops Functions Abstraction
C Standard Library Types

26 Infrastructure as Code
AWSTemplateFormatVersion: ' ' Description: Slack Bot Parameters: BotName: Type: String SlackToken: WitAIToken: Outputs: Url: Value: !Sub Resources: lambdaRole: Type: "AWS::IAM::Role" Properties: AssumeRolePolicyDocument: Version: " " Statement: - Effect: Allow Principal: Service: lambda.amazonaws.com Action: "sts:AssumeRole" Path: / ManagedPolicyArns: - "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" Policies: PolicyName: lambda PolicyDocument: Version: ' ' Effect: Allow Action: - 'lambda:ListFunctions' - 'lambda:InvokeFunction' Resource: '*' botLambda: Type: "AWS::Lambda::Function" Properties: FunctionName: !Ref BotName Handler: index.handler Runtime: nodejs4.3 Role: !GetAtt [ lambdaRole, Arn ] Timeout: 300 Environment: Variables: SLACKTOKEN: !Ref SlackToken WITAITOKEN: !Ref WitAIToken Code: ZipFile: | 'use strict'; const AWS = require('aws-sdk'); const https = require('https'); const url = require('url'); const qs = require('querystring'); const AWS_REGION = process.env.AWS_REGION; const AWS_LAMBDA_FUNCTION_NAME = process.env.AWS_LAMBDA_FUNCTION_NAME; const slackToken = process.env.SLACKTOKEN; const witaiToken = process.env.WITAITOKEN; const lambda = new AWS.Lambda(); exports.handler = (event, context, callback) => { const account_id = context.invokedFunctionArn.split(":")[4]; return processEvent(event, account_id) .then(res => callback(null, formatResponse("200", JSON.stringify({response_type: "in_channel", text: res })))) .catch(err => callback(null, formatResponse("400", err.message || err))) ; }; function processEvent(event, account_id) { // Code for bot command goes here helpLambda: Type: "AWS::Lambda::Function" Properties: FunctionName: !Sub ${BotName}-help Handler: index.handler Runtime: nodejs4.3 Role: !GetAtt [ lambdaRole, Arn ] Timeout: 300 Code: ZipFile: | // Code for bot help goes here botLambdaPermission: Type: "AWS::Lambda::Permission" Properties: Action: "lambda:InvokeFunction" FunctionName: !GetAtt [ botLambda, Arn ] Principal: "apigateway.amazonaws.com" SourceArn: !Sub "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${api}/*" helpLambdaPermission: Type: "AWS::Lambda::Permission" arn:aws:apigateway:${AWS::Region}:lambda:path/ /functions/${lambdaArn}/invocations - lambdaArn: !GetAtt helpLambda.Arn DependsOn: helpLambdaPermission api: Type: "AWS::ApiGateway::RestApi" Name: !Ref BotName anyMethod: Type: "AWS::ApiGateway::Method" AuthorizationType: NONE HttpMethod: ANY RestApiId: !Ref api ResourceId: !GetAtt api.RootResourceId MethodResponses: - StatusCode: 200 Integration: Type: AWS_PROXY IntegrationHttpMethod: POST PassthroughBehavior: WHEN_NO_TEMPLATES Uri: !Sub - arn:aws:apigateway:${AWS::Region}:lambda:path/ /functions/${lambdaArn}/invocations lambdaArn: !GetAtt botLambda.Arn DependsOn: botLambdaPermission deployment: Type: "AWS::ApiGateway::Deployment" Properties: RestApiId: !Ref api StageName: DummyStage DependsOn: anyMethod stage: Type: "AWS::ApiGateway::Stage" StageName: bot DeploymentId: !Ref deployment

27 Other Similar Approaches

28 Programming the Cloud Continue the march of JavaScript from Browser to Server to Cloud Apply Software Engineering to Cloud Infrastructure Work at the right level of abstraction - raw infra or “architecture diagram” Bridge the gap between App and Infra A different kind of application model - “stacks” instead of processes

29 Backup

30 Software Engineering Desiderata
Application Frameworks High-Level Languages Type Checking IDEs Unit Testing Rapid Iteration Debugging CI/CD Source Control Package Management Componentization Integration Testing


Download ppt "Programming the Cloud: Empowering Developers to Do Infrastructure"

Similar presentations


Ads by Google