O'Reilly logo

Mobile DevOps by Jhalak Modi, Rohin Tak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example of instance creation using Terraform

  1. We have a sample configuration file to create an instance and set up a Route 53 DNS using that instance. Save the file as main.tf:
$ vi main.tfvariable "stack_name" { default = "MyTestMachine"}variable "aws_region" { default = "us-east-1" }variable "instance_type" { default = "t2.micro" }variable "instance_count" { default = "1" }variable "route53_zone_id"variable "security_group_id"provider "aws" {  region = "${var.aws_region}"}module "MyTestMachine" {  source = "./ec2_nodes"  instance_type = "${var.instance_type}"  stack_name = "${var.stack_name}"  role = "MyTestMachine"  count = "1"  security_group_id = "${var.security_group_id}"}resource "aws_route53_record" "MyTestMachine" { zone_id = "${var.route53_zone_id}" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required