AWS Configuration#
Prerequisites#
Configure ~/.aws/credentials and ~/.aws/config for the AWS identities that
Cartography should use. Cartography follows the standard boto3 credential
resolution order.
For AWS Organizations hierarchy data, include credentials for the management account or a delegated administrator account.
Authentication#
Single Account#
Configure credentials for an AWS user or role. A single-account sync uses boto3’s normal credential resolution behavior.
Multiple Accounts#
The recommended setup is one named AWS profile for each account and
--aws-sync-all-profiles.
For a hub-and-spoke deployment on EC2:
Create a
cartography-read-onlyrole in every account.Allow the hub account to assume that role in each spoke account.
Create a
cartography-servicerole in the hub account that can callsts:AssumeRoleonarn:aws:iam::*:role/cartography-read-onlyandec2:DescribeRegions.Attach
cartography-serviceto the EC2 instance running Cartography.Add a profile for each account to the AWS config file:
[profile accountname1] role_arn = arn:aws:iam::<AccountId#1>:role/cartography-read-only region = us-east-1 output = json credential_source = Ec2InstanceMetadata [profile accountname2] role_arn = arn:aws:iam::<AccountId#2>:role/cartography-read-only region = us-west-1 output = json credential_source = Ec2InstanceMetadata
The spoke role trust relationship should allow the hub account to assume it:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<HubAccountId>:root"
},
"Action": "sts:AssumeRole"
}
]
}
Required Permissions#
Attach the AWS managed
SecurityAudit policy
(arn:aws:iam::aws:policy/SecurityAudit) to every identity or
cartography-read-only role used by Cartography.
Full AWS Organizations hierarchy enumeration requires credentials from the
management account or a delegated administrator account. Grant
organizations:Describe* and organizations:List* permissions. The managed
SecurityAudit policy includes these actions, but member accounts cannot call
hierarchy APIs such as ListRoots, ListAccountsForParent, and
ListOrganizationalUnitsForParent.
Optional Permissions#
Inspector ingestion requires the AmazonInspector2ReadOnlyAccess policy.
EKS Access Entry ingestion requires
eks:ListAccessEntries, whichSecurityAuditincludes. Granteks:DescribeAccessEntryto populate detailed fields such as the ARN, username, type, and Kubernetes groups.Allowlisted AWS-managed public SSM parameters require
ssm:GetParametersByPathfor the applicable/aws/service/...paths.AWSPublicSSMParameternodes represent shared regional catalog data and are not resources owned by the account performing the sync.The
ecr:pull_through_cache_rulesrequested sync requiresecr:DescribePullThroughCacheRules.AWS Glue connection ingestion requires
glue:GetConnections, whichSecurityAuditdoes not include.
Configure Cartography#
For a single account, no AWS-specific selection flag is required after configuring credentials.
For multiple accounts, use --aws-sync-all-profiles. To make Organizations
discovery predictable at scale, pass the management or delegated
administrator account ID with --aws-organization-account-ids.
Run Cartography#
Run a single-account sync:
cartography --selected-modules aws
Run all configured profiles and use a specific Organizations account:
cartography \
--selected-modules aws \
--aws-sync-all-profiles \
--aws-organization-account-ids 123456789012
Advanced Configuration#
Selective Syncing#
Use --aws-requested-syncs with a comma-separated list of resource
identifiers to limit the resource types that Cartography syncs. Cartography
handles resource dependencies and sync order.
cartography \
--selected-modules aws \
--aws-requested-syncs "ec2:instance,s3,iam"
Additional examples:
cartography --selected-modules aws --aws-requested-syncs "ecr,lambda_function"
cartography --selected-modules aws --aws-requested-syncs "ecr:pull_through_cache_rules"
For the current identifier list, see the RESOURCE_FUNCTIONS dictionary in
cartography/intel/aws/resources.py.
SSM Public Parameter Prefixes#
Cartography ingests AWS-managed public SSM parameters only when their names
start with an allowlisted prefix. Configure a comma-separated list with
--aws-ssm-public-parameter-prefix-allowlist or, when the option is omitted,
with AWS_SSM_PUBLIC_PARAMETER_PREFIX_ALLOWLIST.
The configuration priority is:
--aws-ssm-public-parameter-prefix-allowlistAWS_SSM_PUBLIC_PARAMETER_PREFIX_ALLOWLISTThe built-in defaults:
/aws/service/bottlerocket/and/aws/service/eks/optimized-ami/
Set the CLI option or environment variable to an empty string to disable public parameter ingestion.
export AWS_SSM_PUBLIC_PARAMETER_PREFIX_ALLOWLIST="/aws/service/eks/optimized-ami/,/aws/service/custom/"
cartography --selected-modules aws --aws-requested-syncs ssm
Retry and Timeout Settings#
Cartography-managed AWS clients use these environment variables:
CARTOGRAPHY_AWS_RETRY_MODE:standard,adaptive, orlegacy. The default isstandard.CARTOGRAPHY_AWS_MAX_ATTEMPTS: Maximum retry attempts. The default is3.CARTOGRAPHY_AWS_READ_TIMEOUT: Read timeout in seconds. The default is120.
Lambda regional calls use a 30-second read timeout and two attempts while inheriting the shared retry mode. These settings take precedence over ambient AWS retry environment variables for clients configured by Cartography.
Regional STS Endpoints#
To avoid InvalidToken errors when assuming roles across regions, add
sts_regional_endpoints = regional to the AWS config file or set
AWS_STS_REGIONAL_ENDPOINTS=regional.
Troubleshooting#
If hierarchy APIs are unavailable, Cartography skips AWS Organizations cleanup and continues account resource sync. Verify that the selected Organizations account is the management account or a delegated administrator and can enumerate the complete hierarchy.