Skip to content

Import existing AWS resources to terraform

homepage-banner

Introduction

Terraform is an Infrastructure as Code (IaC) tool that allows you to define and manage your infrastructure in a declarative manner. While creating new resources in AWS using Terraform is straightforward, importing existing resources can be a bit tricky. In this blog post, we will discuss how to import existing AWS resources to Terraform.

Configure AWS credentials

aws configure

Import resource with terraformer

Download terraformer of your platform, https://github.com/GoogleCloudPlatform/terraformer/releases

terraformer import aws --resources=ec2_instance,alb,vpc,subnet --regions=us-east-2

Valid resources include

acm
alb
auto_scaling
customer_gateway
datapipeline
devicefarm
docdb
ebs
ec2_instance
eip
elastic_beanstalk
elb
eni
iam
igw
media_store
medialive
nacl
nat
route53
route_table
sg
subnet
transit_gateway
vpc
vpc_peering
vpn_connection
vpn_gateway
workspaces

Reference

  • https://github.com/GoogleCloudPlatform/terraformer
  • https://github.com/cycloidio/terracognita
Leave a message