Infrastructure As Code (IaC)
AWS - Terraform
Johanes Glenn
Introduction
Johanes Glenn Widiputra
● Software Engineers - Comp. Sci background
● PMO - Methodology & Tools
● Software Integrator
● Solution Architect
● Cloud Architect
LinkedIn: https://www.linkedin.com/in/johanes-glenn
Twitter: @JGlennWP
Medium: @johanes.glenn
Infrastructure as Code - Mengapa? - Tradisional
Web 1 Web 2
Load Balancer
Internet
DB
Stacks dibuat sesuai dengan arsitektur dan
kebutuhan.
Secara tradisional: Semua di handle manual
● Server
● Storage
● Network
● OS
● Apps & kebutuhan (dependencies)
That’s the way it is..
Infrastructure as Code - Mengapa? - Tradisional vs Cloud
Network
Storage
Server
Hypervisor
OSes
Middleware
Apps
Developer
Operation Sw
Operation Hw
Traditional On Premise
Logically Network*
Logically Storage*
Logically Server*
Hypervisor*
OSes
Middleware
Apps
Developer
Operation
AWS
“ * ” = handled automatically by AWS
Infrastructure as Code - Mengapa?
Request Design
Deploy Dev
Env
Deploy QA
Env
Deploy Prod
Env
New Request
FAQs:
● Berapa banyak perubahan?
● Apa saja perubahannya?
● Apakah kita bisa kembali ke versi
sebelumnya?
● Apakah documented sehingga team
lain bisa mengerti?
Additional / New
Version
Infrastructure commonly deployed as waterfall
Infrastructure as Code
Logically Network
Logically Storage
Logically Server
Hypervisor
OSes
Middleware
Apps
Developer
Operation
AWS
Code v1.0
Code v0.5
Code v0.2
API
Difference between three IaC
Deploying AWS using Terraform
Requirement:
1. Terraform
2. AWS IAM Programmatic Access
3. If possible AWS CLI enabled
Create Codes
(TF)
Terraform Init Terraform Plan Terraform Apply
Terraform
Destroy
Check on AWS
Deploying AWS using Terraform
Requirement:
1. Terraform
2. AWS IAM Programmatic Access
3. If possible AWS CLI enabled
Create Codes
(TF)
Terraform Init Terraform Plan Terraform Apply
Terraform
Destroy
Check on AWS
S3 - tfstate
DynamoDB
- Lock
Demo + Q&A
Subnet1
20.0.1.0/24
Subnet2
20.0.2.0.24
DB Subnet Group
ALBRouterIGW
VPC:
20.0.0.0/16
SG: 1
Allow 80 + 443 + 22 from 0.0.0.0/0
SG: 2
Allow 3306 from SG: 1
RT: 1
0.0.0.0/0 to IGW
20.0.0.0/16 to local
User
Data
Web Svr

Infrastructure as code (iac) - Terraform for AWS

  • 1.
    Infrastructure As Code(IaC) AWS - Terraform Johanes Glenn
  • 2.
    Introduction Johanes Glenn Widiputra ●Software Engineers - Comp. Sci background ● PMO - Methodology & Tools ● Software Integrator ● Solution Architect ● Cloud Architect LinkedIn: https://www.linkedin.com/in/johanes-glenn Twitter: @JGlennWP Medium: @johanes.glenn
  • 3.
    Infrastructure as Code- Mengapa? - Tradisional Web 1 Web 2 Load Balancer Internet DB Stacks dibuat sesuai dengan arsitektur dan kebutuhan. Secara tradisional: Semua di handle manual ● Server ● Storage ● Network ● OS ● Apps & kebutuhan (dependencies) That’s the way it is..
  • 4.
    Infrastructure as Code- Mengapa? - Tradisional vs Cloud Network Storage Server Hypervisor OSes Middleware Apps Developer Operation Sw Operation Hw Traditional On Premise Logically Network* Logically Storage* Logically Server* Hypervisor* OSes Middleware Apps Developer Operation AWS “ * ” = handled automatically by AWS
  • 5.
    Infrastructure as Code- Mengapa? Request Design Deploy Dev Env Deploy QA Env Deploy Prod Env New Request FAQs: ● Berapa banyak perubahan? ● Apa saja perubahannya? ● Apakah kita bisa kembali ke versi sebelumnya? ● Apakah documented sehingga team lain bisa mengerti? Additional / New Version Infrastructure commonly deployed as waterfall
  • 6.
    Infrastructure as Code LogicallyNetwork Logically Storage Logically Server Hypervisor OSes Middleware Apps Developer Operation AWS Code v1.0 Code v0.5 Code v0.2 API
  • 7.
  • 8.
    Deploying AWS usingTerraform Requirement: 1. Terraform 2. AWS IAM Programmatic Access 3. If possible AWS CLI enabled Create Codes (TF) Terraform Init Terraform Plan Terraform Apply Terraform Destroy Check on AWS
  • 9.
    Deploying AWS usingTerraform Requirement: 1. Terraform 2. AWS IAM Programmatic Access 3. If possible AWS CLI enabled Create Codes (TF) Terraform Init Terraform Plan Terraform Apply Terraform Destroy Check on AWS S3 - tfstate DynamoDB - Lock
  • 10.
    Demo + Q&A Subnet1 20.0.1.0/24 Subnet2 20.0.2.0.24 DBSubnet Group ALBRouterIGW VPC: 20.0.0.0/16 SG: 1 Allow 80 + 443 + 22 from 0.0.0.0/0 SG: 2 Allow 3306 from SG: 1 RT: 1 0.0.0.0/0 to IGW 20.0.0.0/16 to local User Data Web Svr

Editor's Notes

  • #3 Some introduction of myself
  • #4 Opening about infrastructure deployment
  • #5 Perbedaan deployment on infra tradisional vs in AWS
  • #8 Hal utama yang ingin di share disini adalah promote memang CDK. CloudFormation: very good tetapi take a very long lines to write (700ish) CDK: it is very useful, on the same result only 35 lines of codes The issue for some people who does not really have experience is writing codes (really love straight forward information) these is Terraform is. Example for CDK: https://github.com/aws-samples/aws-cdk-examples
  • #9 Bagaimana menggunakan Terraform: Create terraform codes (TF files) terraform init = Initialize Terraform di folder tersebut (dilakukan pertama kali) terraform plan = Simulate hasil akhir (apa yg di deploy, apa yg di destroy, apa yg stay as is) terraform apply = Start deployment terraform destroy = delete environment
  • #10 Tambahan arsitektur ketika diinginkan multiple people active di env yang sama kita introduce (open-source tf + tfstate di S3 + locking di DynamoDB)
  • #11 Example terraform for Demo: https://github.com/alevz257/terraform-workshop.git (notes: test on version 0.12 Terraform) → please change the profile as needed