Skip to main content

Terraform : How to launch AWS EC2 using Terraform Code.

 

provider "aws" {

  region = "ap-south-1"

}


resource "aws_instance" "MyVm" {

  ami           = "ami-0a4a4775bdbcXXXX"

  instance_type = "t2.micro"

  tags = {

    "Name" : "MyVM"

  }

}

Comments

  1. Nice and simple example—exactly what beginners need when starting with AWS automation. I remember my first EC2 launch with Terraform, and it felt like magic compared to manual setup. Curious—will you also cover security groups and key pairs in a follow-up?

    ReplyDelete

Post a Comment

Popular posts from this blog

Microsoft Certified: Azure Solutions Architect Expert Course Content

  Prerequisites Successful Azure Architect students have prior experience with operating systems, virtualization, cloud infrastructure, storage structures, and networking: Understanding of on-premises virtualization technologies, including VMs and virtual networking Understanding of network configuration, including TCP/IP, Domain Name System (DNS), virtual private networks (VPNs), firewalls, and encryption technologies Understanding of Active Directory concepts, including domains, forests, and domain controllers If you are new to Azure and cloud computing, consider one of the following resources: Free online: Azure Fundamentals ( https://docs.microsoft.com/learn/paths/azure-fundamentals/ ) Instructor-led course: AZ-900: Azure Fundamentals ( https://docs.microsoft.com/learn/certifications/courses/az-900t01 ) Prerequisites for Azure administrators ( https://docs.microsoft.com/learn/paths/az-104-administrator-prerequisites/ Course outline Module 1: Implement Azure Active Directory In ...

Terraform Commands

  Terraform Cheat Sheet terraform version $ terraform version Terraform v1.0.1 on darwin_amd64 terraform init $ terraform init Ask for input if necessary. If false, will error if input was required. $ terraform init -input=false You can also change the backend details using  -backend-config  option.,  reconfigure  will reconfigure the backend, ignoring any saved configuration . $ terraform init -backend-config=PATH/TO/CONFIGURATION_FILE -reconfigure