Rajan Silwal
  • 👋Welcome to My Personal Page
  • Project
    • 👨‍💼Daily Activities
    • ⚠️Monitoring Tools
    • ✍️Git
    • 🏎️Automation Tools
    • 💻Virtualization
    • 🖥️Immutable Infrastructure
    • 🔶Cloud (AWS)
    • ⛲Container
  • ⚠️Monitoring Tools
    • 💡Prometheus
      • How to Setup Prometheus
      • Setup Node-exporter
      • Setup Prometheus to get metrics
    • 💡Grafana
    • 💡Nagios
  • ✍️Git
    • 🐇CI/CD in Git
      • Setup Git for CICD
  • ⛲Container
    • 📍Docker
      • Docker image
      • Same Docker image in VM
  • 🚗k8s
    • Install K8S
  • 🏎️Automation Tools
    • 🖨️Ansible
      • List of my Ansible Playbook
    • Terraform
      • Setup Terraform in AWS
      • Create VPC using .tf
      • Create EC2 using .tf
      • Command Familiars in Terraform
  • 💻Virtualization
    • 🔄OpenNebula
      • Setup OpenNebula
      • Onehost Server
      • Build VM in OpenNebula
  • 🔶Cloud (AWS)
    • 🌥️EC2
    • 🌥️IAM
    • 🌥️VPC
    • 🌥️Load Balancer
    • 🌥️S3 Bucket
    • 🌥️Route 53
  • 🖥️Immutable Infrastructure
    • 1️⃣1⃣ Content
    • 2️⃣2⃣ Virt-Install
    • 3️⃣3⃣ Base Image
    • 4️⃣4⃣ Golden-Image
    • 5️⃣5⃣ After-Golden-Image
Powered by GitBook
On this page
  1. Automation Tools
  2. Terraform

Setup Terraform in AWS

PreviousTerraformNextCreate VPC using .tf

Last updated 2 years ago

Step 1: Create a IAM user in AWS. Here is the process to create IAM user. Step 2: Create one repository in Gitlab, clone that git repo in your local computer. Now, we need to install AWS extension on VS code. Once you add extension, go to command palette and search for AWS:credentials profile. Add your aws_access_key_id and aws_secret_access_key. Step 3: It will ask you to choose your zone. Please select one or more zone that you want to work on.

Step 4: Open that repository that we create in our local computer.

Step 5: Create a file name called providers.tf inside our repo. Add following line of code in providers.tf which will link to our AWS console.

# You can find this script in terrafrm page for AWS providers
terraform {
    required_providers {
        aws = {
            source  = "hashicorp/aws"
            version = "~> 4.0"
        }
    }
}
# It will link to our AWS account uisng access_key and secret_key
provider "aws" {
    region     = "us-west-1"
}

Step 6: Just to confirm we can run terraform init in terminal. Now it should show following output: Now, we have successfully initialized our terraform.

🏎️
https://app.gitbook.com/o/Sl85xsDKUHFlvowLtBga/s/9wnMXVEmEJ7k6VEhLJYN/~/changes/kPHMMpBOqOYvqWeP0spW/aws/opennebula-2