Start a resource scan with AWS CloudFormation IaC generator - AWS CloudFormation

Start a resource scan with AWS CloudFormation IaC generator

Before you create a template from existing resources, you first must initiate a scan of your resources to discover all provisioned resources and the relationship between resources. Depending on how many resources you have in your account and the specified AWS Region, this scanning process can take some time to complete.

Start a resource scan (console)

To start a resource scan
  1. Open the IaC generator page of the CloudFormation console.

  2. On the navigation bar at the top of the screen, choose the AWS Region that contains the resources to scan.

  3. From the Scans panel, choose Start a new scan.

Start a resource scan (AWS CLI)

To start a resource scan

Use the following start-resource-scan command. Replace us-east-1 with the AWS Region that contains the resources to scan.

aws cloudformation start-resource-scan --region us-east-1

If successful, this command returns the ARN of the scan. Note the ARN in the ResourceScanId property. You need it to create your template.

{ "ResourceScanId": "arn:aws:cloudformation:region:account-id:resourceScan/0a699f15-489c-43ca-a3ef-3e6ecfa5da60" }
To monitor the progress of a resource scan

Use the describe-resource-scan command. For the --resource-scan-id option, replace the sample ARN with the actual ARN.

aws cloudformation describe-resource-scan --region us-east-1 \ --resource-scan-id arn:aws:cloudformation:us-east-1:123456789012:resourceScan/0a699f15-489c-43ca-a3ef-3e6ecfa5da60

If successful, this command returns the following.

{ "ResourceScanId" : "arn:aws:cloudformation:region:account-id:resourceScan/0a699f15-489c-43ca-a3ef-3e6ecfa5da60", "Status": "COMPLETE", "StartTime": "2023-08-21T03:10:38.485000+00:00", "EndTime": "2023-08-21T03:20:28.485000+00:00", "PercentageCompleted": 100.0, "ResourceTypes": [ "AWS::EKS::Cluster", "AWS::AutoScaling::AutoScalingGroup" ], }

For a description of the fields in the output, see DescribeResourceScan in the AWS CloudFormation API Reference.