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

Cloud Superpowers with Pulumi and F#

Cloud Superpowers with Pulumi and F#

Feeling daunted creating cloud resources by clicking around in web portals or automating your deployments with scripts, YAML files, or JSON templates?

In this talk, Mikhail will introduce Pulumi, an open-source tool that leverages programming languages to manage infrastructure, yet in a declarative manner! Using developer tools that you know and love, you can now apply unit testing, reusable architecture, and continuous delivery while provisioning resources in the cloud. Obtain the cloud superpowers while using F#!

Mikhail Shilkov

June 05, 2020
Tweet

More Decks by Mikhail Shilkov

Other Decks in Programming

Transcript

  1. About me • Mikhail Shilkov • Software engineer at Pulumi

    .NET SDK, Azure, Core platform • Serverless • Functional programming, F# • Microsoft Azure MVP @MikhailShilkov [email protected]
  2. Intro • Pulumi: Modern Infrastructure as Code • F# to

    manage cloud resources Cloud Superpowers • Provisioning • Architecture • Testing • Delivery Agenda
  3. F#!

  4. Providers • AWS • Azure • GCP • Digital Ocean

    • Cloudflare … and more • Docker • Kubernetes • OpenStack • PostgreSQL • New Relic
  5. Tools that you love • .NET Core 3.1 • OS:

    Windows, macOS, Linux • Editor and IDE: Visual Studio, Code, Rider • IntelliSense, ReSharper, StyleCop, DocFX • Package Manager: Paket, NuGet, MyGet • NUnit, xUnit.net, Moq, FsUnit, FsCheck
  6. let resourceGroup = ResourceGroup "rg" let storageAccount = Account("storage", AccountArgs

    (ResourceGroupName = io resourceGroup.Name, AccountReplicationType = input "LRS", AccountTier = input "Standard")) F# Example
  7. Desired State! let resourceGroup = ResourceGroup "rg" let storageAccount =

    Account("storage", AccountArgs (ResourceGroupName = io resourceGroup.Name, AccountReplicationType = input "LRS", AccountTier = input "Standard"))
  8. How Pulumi Works CLI & engine Last deployed state Program.fs

    Language host AWS Azure GCP Kubernetes new Resource() CRUD
  9. let resourceGroup = ResourceGroup "rg" let storageAccount = Account("storage", AccountArgs

    (ResourceGroupName = io resourceGroup.Name, AccountReplicationType = input "LRS", AccountTier = input "Standard")) Dependency Definitions
  10. // A resource group to contain our Azure Functions let

    resourceGroup = ResourceGroup "functions-rg" // A .NET Azure Function let dotnet = ArchiveFunctionApp("http", ArchiveFunctionAppArgs (ResourceGroup = resourceGroup, Archive = new FileArchive("./dotnet/publish"))) .NET Azure Function
  11. Let’s run pulumi up … Type Name Plan + pulumi:pulumi:Stack

    functions-dev create + ├─ azure:appservice:ArchiveFunctionApp http create + │ ├─ azure:storage:Account http create + │ ├─ azure:appservice:Plan http create + │ ├─ azure:storage:Container http create + │ ├─ azure:storage:ZipBlob http create + │ └─ azure:appservice:FunctionApp http create + └─ azure:core:ResourceGroup rg create
  12. // A resource group to contain our Azure Functions let

    resourceGroup = ResourceGroup "functions-rg" // A .NET Azure Function let dotnet = ArchiveFunctionApp("http", ArchiveFunctionAppArgs (ResourceGroup = resourceGroup, Archive = new FileArchive("./ javascript ") Runtime = "node")) Node.js Azure Function
  13. let linuxResourceGroup = ResourceGroup "linux-rg" let linuxPlan = Plan("linux-asp", PlanArgs

    (ResourceGroupName = io linuxResourceGroup.Name, Kind = input "Linux", Reserved = input true)) let python = ArchiveFunctionApp(...); Python Azure Function on Linux
  14. let linuxResourceGroup = ResourceGroup "linux-rg" let linuxPlan = Plan("linux-asp", PlanArgs

    ( ... )) let python = ArchiveFunctionApp("py", ArchiveFunctionAppArgs (ResourceGroup = linuxResourceGroup, Archive = new FileArchive("./python"), Plan = linuxPlan, Runtime = "python")) Python Azure Function on Linux
  15. [<Test>] member this.ResourceGroupHasEnvironmentTag() = let resources = Deployment.TestAsync<WebsiteStack>() |> runSync

    let resourceGroup = resources.OfType<ResourceGroup>() |> Seq.head let tags = getValue resourceGroup.Tags tags.Should().NotBeNull("Tags must be defined") |> ignore tags.Should().ContainKey("Environment", null) |> ignore Unit Testing
  16. [<Test>] member this.ResourceGroupHasEnvironmentTag() = let resources = Deployment.TestAsync<WebsiteStack>() |> runSync

    let resourceGroup = resources.OfType<ResourceGroup>() |> Seq.head let tags = getValue resourceGroup.Tags tags.Should().NotBeNull("Tags must be defined") |> ignore tags.Should().ContainKey("Environment", null) |> ignore Unit Testing
  17. [<Test>] member this.ResourceGroupHasEnvironmentTag() = let resources = Deployment.TestAsync<WebsiteStack>() |> runSync

    let resourceGroup = resources.OfType<ResourceGroup>() |> Seq.head let tags = getValue resourceGroup.Tags tags.Should().NotBeNull("Tags must be defined") |> ignore tags.Should().ContainKey("Environment", null) |> ignore Unit Testing
  18. Deployment process Allow developers to iterate quickly on dev environments.

    Gain visibility and change management with Continuous Delivery.
  19. Cloud Transition Kubernetes Azure Functions AWS S3 Azure Analytics Google

    ML MySQL DataDog App Docker DataDog New Relic App MySQL EARLY CLOUD Mostly Static N-Tier Apps VMs Private Cloud CURRENT CLOUD Partly Dynamic Less Monolithic VMs and Containers* Hybrid - Public/Private *Experimentation FUTURE CLOUD Fully Dynamic Hyper-Connected Services Containers and Serverless Mostly Public Cloud
  20. Infrastructure Landscape Foundation Security IAM KMS Networking VPC Subnets Firewalls

    Load Balancing DNS Compute VMs Containers Clusters Registries APM Monitoring Logging Alerting Serverless Functions API Gateways Data Object Stores Databases SQL NoSQL MQ Queues Pub/Sub Applications Images Container Images Code Packaging CI/CD
  21. Example: Kubernetes Managed Kubernetes cluster Infrastructure Resources (networking, storage, identity)

    Managed Service Managed Service Application Application Application
  22. PROVISIONING Developer-friendly Familiar language experience, toolchain, packages – applied to

    cloud infrastructure. Developers and operators working in a team. Cloud Engineering Transformed TESTING Confidence and quality Unit testing and TDD with battle-tested tools to ensure correctness. Policy as Code for compliance, cost control, and company-wide best practices. ARCHITECTURE Logic and abstractions Conditionals, loops, functions, classes, and packages out of the box. Reusable components that encapsulate complex logic and provider the right level of abstraction. Modern Infrastructure as Code Capabilities to ship faster and with confidence