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

IaCでクラウドのインフラ運用を効率化しよう

 IaCでクラウドのインフラ運用を効率化しよう

2021年12月に開催した、Oracle Developer Day 2021の公演資料です。

Oracle Cloud InfrastructureでのIaCの推進を支える様々なサービスやツールをご紹介しながら、クラウド上でのインフラ運用を効率化する方法についてお伝えします。

Masataka Marukawa

December 17, 2021
Tweet

More Decks by Masataka Marukawa

Other Decks in Technology

Transcript

  1. IaCでクラウドインフラの運⽤を効率化しよう 丸川祐考 日本オラクル株式会社 Solution Engineer 2021/12/17 1 Copyright © 2021,

    Oracle and/or its affiliates
  2. 丸川 祐考 Masataka Marukawa 日本オラクル株式会社 ソリューション・エンジニア 2 Copyright © 2021,

    Oracle and/or its affiliates @mmarukaw Twitter/GitHub/Qiita
  3. 3 Copyright © 2021, Oracle and/or its affiliates Agenda 1.

    Infrastructure as Code と OCIでの活用 2. OCIでのTerraformの利用 3. OCI Resource Manager
  4. Infrastructure as Code と OCIでの活用 4 Copyright © 2021, Oracle

    and/or its affiliates
  5. IT Copyright © 2021, Oracle and/or its affiliates 5 •

    • • • IT • • • • • DevOps • Infrastructure-as-Code
  6. Infrastructure as Code IT ( ) Kief Morris - Infrastrucrue

    as Code 2nd Edition – O'reilly 2020 Infrastructure as Code (IaC) Copyright © 2021, Oracle and/or its affiliates 6 DEPLOY DELIVER TEST BUILD CODE Infrastructure
  7. • IT • IT (装 ) • IT 装 •

    • • • DevOps Infrastructure as Code (IaC) Copyright © 2021, Oracle and/or its affiliates 7 GUI
  8. 8 IaC - Virtual Machine Virtual Cloud Network Internet Gateway

    Route Table Security Lists Block Storage Subnet • ) • “ ” ” ” Copyright © 2021, Oracle and/or its affiliates
  9. 9 Copyright © 2021, Oracle and/or its affiliates 1. (Bash,

    Perl, PowerShell, Ruby, Python… +SDK) • (Procedural) 2. (DSL) (CFEngine, Puppet, Chef, Ansible) • ( ) (=Declarative) 3. (Terraform, CloudFormation) • (=Idenpotency) (= ) 4. (Pulumi, AWS CDK ) • TypeScript, Python, Java • ( ) 2000 2010 2020
  10. • (Declarativity) • ( ) ( ) (Idempotency) • (

    ) • ( ) • – 10 yum install nginx yum: name: nginx state: installed (= ) Copyright © 2021, Oracle and/or its affiliates
  11. Copyright © 2021, Oracle and/or its affiliates 11 SDKs Java,

    Python, TypeScript/JavaScript, .NET, Ruby, Go, PL/SQL, CLI Terraform OCI Provider Ansible Collections OCI API REST Endpoints Resource Manager OCI
  12. OCI での Terraform の利用 12 Copyright © 2021, Oracle and/or

    its affiliates
  13. Terraform HashiCorp • • (300+) • HCL (HashiCorp Configuration Language)

    (DSL) • (State) ( OK) • Terraform – 13 Copyright © 2021, Oracle and/or its affiliates
  14. 14 Terraform – Terraform (GRUD ) • • Provider $

    terraform apply • ( ) • $ terraform apply • • $ terraform destroy • $ terraform show • $ terraform graph Copyright © 2021, Oracle and/or its affiliates
  15. 15 Terraform – Terraform Core Provider Terraform Plugins Provisioners Client

    Library GO HTTP(S) Cloud *.tf JSON OR State .tfstate State (terraform.tfstate) Terraform state REST API Provider State Copyright © 2021, Oracle and/or its affiliates
  16. https://github.com/terraform-providers/terraform-provider-oci/blob/master/examples/networking/vcn/vcn.tf resource "oci_core_virtual_network" "vcn1" { cidr_block = "10.0.0.0/16" dns_label =

    "vcn1" compartment_id = "var.compartment_ocid" display_name = "vcn1" } resource "oci_core_instance" "instance1" { availability_domain = data.oci_identity_availability_domain.ad1.name compartment_id = var.compartment_ocid display_name = "be-instance1" shape = var.instance_shape metadata = { user_data = base64encode(var.user-data) } } Terraform Copyright © 2021, Oracle and/or its affiliates 16
  17. デモ Copyright © 2021, Oracle and/or its affiliates 17 Terraformサンプルを利用したOCIリソースの作成、変更

    • https://github.com/terraform-providers/terraform-provider-oci/tree/master/examples
  18. OCI Resource Manager 18 Copyright © 2021, Oracle and/or its

    affiliates
  19. Infrastructure-as-Code OCI ( ) OCI Resource Manager 19 = Terraform-as-a-Service

    • Terraform OCI • HCL(HashiCorp Configuration Language) Terraform • (State) OCI OCI • OCI CRUD • OCI API IAM Audit OCI • OCI (Discovery / ) Copyright © 2021, Oracle and/or its affiliates Resource Manager
  20. Terraform • Terraform • OCI Resource Manager • • Resource

    Manager • WebUI/CLI/API Terraform OCI Resource Manager Copyright © 2021, Oracle and/or its affiliates 20
  21. 21 Terraform vs. OCI Resource Manager Terraform OCI Resource Manager

    State terraform OCI RM • RM • state • OCI IAM • Stack. Terraform Copyright © 2021, Oracle and/or its affiliates
  22. • OCI • Terraform (.tf) • : Plan, Apply, Destroy

    State • (.tfstate) • Resource Manager • • OCI Resource Manager Copyright © 2021, Oracle and/or its affiliates 22 1 2 3 State Destroy Apply Plan 1 2 … .tf Resource Manager
  23. 23 OCI Resource Manager – Terraform Terraform https://docs.cloud.oracle.com/iaas/Content/ResourceManager/Concepts/resourcemanager.htm#workflow Plan '

    Terraform Apply State Destroy Copyright © 2021, Oracle and/or its affiliates
  24. デモ Copyright © 2021, Oracle and/or its affiliates 24 OCI

    Resource Managerを利用したOCIリソースの作成 • テンプレートを利用したネットワークリソースの作成 • zipしたTerraform構成ファイルをアップロードしてロードバランサとWebサーバーを構成 • ソースコードリポジトリ (GitHub) と連携した構成の実行
  25. … Copyright © 2021, Oracle and/or its affiliates 25

  26. Terraform • Resource Manager • HCL Oracle Cloud Infrastructure •

    Copyright © 2021, Oracle and/or its affiliates 26
  27. Resource Manager (=state ) OCI = Copyright © 2021, Oracle

    and/or its affiliates 27
  28. Ansible ← AVAILABLE OCI DevOps Resource Manager Copyright © 2021,

    Oracle and/or its affiliates 28
  29. Infrastructure-as-code Oracle Cloud Infrastructure OCI Resource Manager / Terraform OCI

    IaC Copyright © 2021, Oracle and/or its affiliates 29
  30. Thank you Copyright © 2021, Oracle and/or its affiliates 30