# How to quickly import existing AWS infrastructure into Terraform

When working on new backend projects, you get the opportunity to start provisioning the infrastructure with Terraform from the get-go. This makes it easier to onboard new team members and to manage subsequent changes to your infrastructure after your project is launched, all of which are version-controlled. However, most people don’t work on new projects; they maintain existing systems. In the past, transitioning from using the AWS console to Terraform for provisioning resources was not simple.

The [terraform import](https://developer.hashicorp.com/terraform/cli/import) command only imported the resource into your state file, meaning you had to cross-check with the console and write the corresponding Terraform code by hand. You could both generate the Terraform code and state file using [terraformer](https://github.com/GoogleCloudPlatform/terraformer) (which is no longer maintained). However, this gets tricky if you already have part of your infrastructure in Terraform and want to import the rest that are not.

I recently discovered that Terraform has introduced a new approach that solves both issues with terraform import and terraformer. All you need to do is specify the ID of the resource in AWS, like the example below

![](https://cdn.hashnode.com/uploads/covers/62ff40f28bec3d0c4588b103/f17ee874-5bdf-4130-b4f2-d250803f94f4.png align="center")

Then, run the following commands.

![](https://cdn.hashnode.com/uploads/covers/62ff40f28bec3d0c4588b103/5d03011b-1875-4890-8771-701628b7e3bb.png align="center")

And that’s it!. That resource has been imported into your Terraform state. You can now manage it using Terraform.
