Demo for bulk import of AWS resources.
This repo contains code to fully test/demonstrate bulk import of resources from AWS into Pulumi using boto3 to query AWS for resources, and then outputting a JSON file suitable for use with pulumi import
:
- The
sample-infra
directory contains a Pulumi project that generates some sample infrastructure to be imported (to save the trouble of having to create a bunch of resources manually through the AWS console). - The
import-target
directory contains a Pulumi project intended to be the target of thepulumi import
command.
-
Clone
pulumi/pulumi-import-account-scraper
from the root of this repo. (The directory is.gitignore
-d.) -
Create a
virtualenv
for the account scraper, activate thevirtualenv
, and install the account scraper's dependencies:cd pulumi-import-aws-account-scraper virtualenv -p python3 venv source venv/bin/activate pip install -r requirements.txt
-
(Optional) Generate some resources by running the Pulumi stack in
sample-infra
. -
Run the account scraper to generate a JSON file for
pulumi import
:cd pulumi-import-aws-account-scraper source venv/bin/activate python account_scraper.py > ../pulumi-import.json
-
Import the infrastructure into the target project:
pulumi import -f ../pulumi-import.json -o imported-resources.ts -y