Skip to content
Linxus Infotech
Product Features How it works Pricing Compare Blog
Sign in Start free scan›
Guide · Getting started

How to Connect Your AWS Account to InfraSync

Grant InfraSync read-only access to your AWS account using a cross-account IAM role or an IAM user — with console, AWS CLI and CloudFormation procedures for each.

By Linxus Infotech Updated Sep 6, 2026 7 min read

InfraSync scans your AWS account with read-only access and generates Terraform plus cost-optimization recommendations. It never creates, modifies, or deletes your AWS resources. This guide covers both ways to grant that access — a cross-account IAM role, or an IAM user with access keys — using the AWS Management Console, the AWS CLI, or AWS CloudFormation.

  • Prerequisites
  • Choosing a connection method
  • Permissions reference
  • Method 1 — Cross-account IAM role (recommended)
  • Method 2 — IAM user with access keys
  • Optional permissions
  • Adding the account to InfraSync
  • Verifying the connection
  • Revoking access
  • FAQ

Prerequisites

Before you begin

  • An AWS account, and permission to create IAM roles or users in it (iam:CreateRole or iam:CreateUser).
  • An InfraSync account. Sign up free if you do not have one.
  • For the cross-account role: the external ID InfraSync generates for this account. You get it in Method 1, step 1.
  • The AWS CLI, if you plan to follow the CLI procedures rather than using the console.
Note

In the commands on this page, replace values written in UPPER_CASE with your own. Everything else can be pasted as written.

Choosing a connection method

Both methods give InfraSync the same read-only access. They differ in what you hand over and how you revoke it.

Cross-account roleAccess keys
Credentials sharedNone. InfraSync assumes the role for short-lived credentials.A long-lived access key ID and secret.
Stored by InfraSyncOnly the role ARN.The secret, encrypted.
Revoking accessDelete the role.Delete the access key or user.
Extra protectionExternal ID condition on the trust policy.None beyond the key itself.
Setup timeAbout 5 minutes, or one CloudFormation stack.About 2 minutes.
Recommended forProduction accounts.Trials and sandbox accounts.
Note

Use the cross-account role for any account you care about. Nothing long-lived is stored, and deleting the role ends access account-wide and immediately. Access keys exist for speed, not for parity.

Permissions reference

For scanning and cost analysis, InfraSync is read-only. The AWS managed ReadOnlyAccess policy covers all of it:

  • Scanner — Get*, List* and Describe* across EC2, S3, RDS, IAM, VPC, Lambda, ECS, EKS and the rest of the 89 supported services, to build your Terraform.
  • Cost optimizer — compute-optimizer:Get*, ce:Get* (Cost Explorer and Savings Plans) and ec2:Describe* for right-sizing and idle-resource findings.

Attach ReadOnlyAccess and you are done. It is a superset of everything above and stays correct as AWS adds services — a hand-built action list eventually misses one and breaks a scan.

Note

You do not have to get this exactly right up front. InfraSync validates access when you connect and again before every scan, and names the exact action to add if one is missing.

Two features need one extra permission each. Both are optional and covered in Optional permissions. Live drift detection needs no additional permission at all — see Live drift setup.

Method 1 — Cross-account IAM role (recommended)

You create a read-only role that InfraSync assumes for short-lived credentials. The role trusts InfraSync's AWS account (529928147507) and is scoped by an external ID — a per-account value that prevents the confused deputy problem.

Step 1 — To get your external ID

  1. In InfraSync, open Connect your account.
  2. Choose Cross-account role as the connection method.
  3. Note the two values shown: InfraSync's AWS account ID (529928147507) and the external ID generated for this account.
Important

The external ID is unique to this account. Do not reuse one from another account, and do not invent your own — the trust policy must match the value InfraSync will present.

Then create the role using whichever of the following you prefer. All three produce the same result.

Step 2, option A — To create the role with AWS CloudFormation

Download the template, or copy it from below.

  1. Open the AWS CloudFormation console and choose Create stack, then With new resources (standard).
  2. Choose Upload a template file and select infrasync-readonly-role.yaml.
  3. For ExternalId, enter the external ID from step 1.
  4. Select I acknowledge that AWS CloudFormation might create IAM resources with custom names, then create the stack.
  5. When the stack reaches CREATE_COMPLETE, open the Outputs tab and copy the RoleArn value.

To do the same with the AWS CLI, save the template as infrasync-readonly-role.yaml and run:

aws cloudformation deploy \
  --template-file infrasync-readonly-role.yaml \
  --stack-name infrasync-readonly-role \
  --capabilities CAPABILITY_NAMED_IAM \
  --parameter-overrides ExternalId=EXTERNAL_ID

aws cloudformation describe-stacks \
  --stack-name infrasync-readonly-role \
  --query "Stacks[0].Outputs[?OutputKey=='RoleArn'].OutputValue" \
  --output text

The template itself:

AWSTemplateFormatVersion: "2010-09-09"
Description: "InfraSync read-only cross-account role."

Parameters:
  ExternalId:
    Type: String
    NoEcho: true
    Description: "The External ID InfraSync showed you for this account."
  RoleName:
    Type: String
    Default: "infrasync-readonly-role"

Resources:
  InfraSyncReadOnlyRole:
    Type: "AWS::IAM::Role"
    Properties:
      RoleName: !Ref RoleName
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: Allow
            Principal:
              AWS: "arn:aws:iam::529928147507:root"
            Action: "sts:AssumeRole"
            Condition:
              StringEquals:
                "sts:ExternalId": !Ref ExternalId
      ManagedPolicyArns:
        - "arn:aws:iam::aws:policy/ReadOnlyAccess"

Outputs:
  RoleArn:
    Description: "Paste this Role ARN into InfraSync."
    Value: !GetAtt InfraSyncReadOnlyRole.Arn

Step 2, option B — To create the role in the AWS Management Console

  1. Open the IAM console and choose Roles, then Create role.
  2. For trusted entity type, choose Custom trust policy.
  3. Paste the trust policy below, replacing EXTERNAL_ID with the value from step 1.
  4. Attach the ReadOnlyAccess managed policy.
  5. Name the role — for example infrasync-readonly-role — and create it.
  6. Open the role and copy its Role ARN.
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": { "AWS": "arn:aws:iam::529928147507:root" },
      "Action": "sts:AssumeRole",
      "Condition": {
        "StringEquals": { "sts:ExternalId": "EXTERNAL_ID" }
      }
    }
  ]
}

Step 2, option C — To create the role with the AWS CLI

# 1. Save the trust policy, using the external ID from step 1
cat > infrasync-trust.json <<'JSON'
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": { "AWS": "arn:aws:iam::529928147507:root" },
    "Action": "sts:AssumeRole",
    "Condition": { "StringEquals": { "sts:ExternalId": "EXTERNAL_ID" } }
  }]
}
JSON

# 2. Create the role and attach ReadOnlyAccess
aws iam create-role \
  --role-name infrasync-readonly-role \
  --assume-role-policy-document file://infrasync-trust.json

aws iam attach-role-policy \
  --role-name infrasync-readonly-role \
  --policy-arn arn:aws:iam::aws:policy/ReadOnlyAccess

# 3. Print the Role ARN to paste into InfraSync
aws iam get-role --role-name infrasync-readonly-role \
  --query "Role.Arn" --output text

Method 2 — IAM user with access keys

Create an IAM user with the ReadOnlyAccess managed policy and an access key you paste into InfraSync. This works immediately and is the fastest way to try a scan.

Warning

An access key is a long-lived credential. If it leaks, it is valid until someone deletes it. For production accounts, use Method 1 instead.

To create the user in the AWS Management Console

  1. Open the IAM console and choose Users, then Create user.
  2. Name the user — for example infrasync-readonly — and do not grant console access.
  3. Choose Attach policies directly and select ReadOnlyAccess.
  4. Create the user, then open it and choose Security credentials, Create access key.
  5. For the use case, choose Third-party service.
  6. Copy both the access key ID and the secret access key.
Important

The secret access key is shown only once. If you lose it, delete the access key and create a new one — it cannot be retrieved later.

To create the user with the AWS CLI

aws iam create-user --user-name infrasync-readonly

aws iam attach-user-policy \
  --user-name infrasync-readonly \
  --policy-arn arn:aws:iam::aws:policy/ReadOnlyAccess

# Prints the access key ID and secret — paste both into InfraSync
aws iam create-access-key --user-name infrasync-readonly \
  --query "AccessKey.[AccessKeyId,SecretAccessKey]" --output table

Optional permissions

Each of these is a single, narrowly scoped permission added alongside ReadOnlyAccess. Neither touches your infrastructure. Add one only if you use the feature it unlocks.

To let InfraSync enable AWS Compute Optimizer

AWS Compute Optimizer is opt-in per account and returns nothing until enrolled. Grant this to make the Enable Compute Optimizer button work; otherwise enable it yourself in the AWS console and skip this. Everything else works either way.

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": "compute-optimizer:UpdateEnrollmentStatus",
    "Resource": "*"
  }]
}

To store Terraform state in your own S3 bucket

Only needed if you turn on the S3 remote-state backend with a bucket you own. InfraSync writes the generated terraform.tfstate there using the credentials you connected, so that role or user needs write access to that one bucket. ReadOnlyAccess already allows the reads; this adds the writes.

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["s3:PutObject", "s3:GetObject", "s3:DeleteObject", "s3:ListBucket"],
    "Resource": [
      "arn:aws:s3:::TFSTATE_BUCKET",
      "arn:aws:s3:::TFSTATE_BUCKET/*"
    ]
  }]
}
Note

State locking is S3-native, so there is no DynamoDB table to create.

Using an encrypted (SSE-KMS) backend? Also allow kms:Decrypt and kms:GenerateDataKey on that key. Our read-only IAM guide covers the reasoning in more depth.

Adding the account to InfraSync

To connect the account

  1. In InfraSync, open Connect your account.
  2. Paste your role ARN (Method 1) or your access key ID and secret (Method 2).
  3. Choose a default region.
  4. Choose Save. InfraSync validates the credentials immediately.

Verifying the connection

InfraSync validates access on save and again before every scan, so a successful save is already a real check — it performs an sts:GetCallerIdentity against the credentials you gave it and reports the AWS account ID it resolved.

Note

Confirm the account ID InfraSync reports is the account you intended to connect. If it is not, you have pasted credentials for a different account.

To verify a cross-account role yourself before connecting it:

aws sts assume-role \
  --role-arn arn:aws:iam::YOUR_ACCOUNT_ID:role/infrasync-readonly-role \
  --role-session-name verify \
  --external-id EXTERNAL_ID

An AccessDenied here almost always means the external ID does not match the one in the trust policy.

Revoking access

Revocation is immediate and account-wide, with no leftover secrets.

  • Cross-account role — delete the role, or remove the ReadOnlyAccess policy from it. If you deployed the CloudFormation stack, deleting the stack removes the role.
  • Access keys — delete the access key, or the IAM user.

Next steps

  • Run your first scan and review the generated Terraform.
  • Set up live drift detection to hear about changes seconds after they happen. It needs no additional IAM permission.
  • Read how to create a read-only IAM role for the deeper reasoning on least privilege and external IDs.

Read-only access you control.

InfraSync only ever reads your AWS account to generate Terraform and cost insights — and you can revoke its access at any time.

Start a free scan›

FAQ

What permissions does InfraSync need?

For scanning and cost analysis it is read-only — the AWS managed ReadOnlyAccess policy covers the scanner and the cost optimizer, and InfraSync never creates, modifies, or deletes your resources. Two features each need one extra, narrowly scoped permission: the Enable Compute Optimizer button (compute-optimizer:UpdateEnrollmentStatus) and storing Terraform state in your own S3 bucket (s3:PutObject and s3:DeleteObject on that bucket). Both are optional — see Optional permissions.

Should I use a role or access keys?

A cross-account role for anything you care about. InfraSync assumes it for short-lived credentials, nothing long-lived is stored, and you revoke access by deleting the role. Access keys are simpler and work immediately, which makes them fine for a trial or a sandbox account.

Does live drift detection need extra permissions?

No. Events are pushed out of your account by EventBridge rather than pulled in, so it adds no IAM permission at all. It does need configuration in your account — see Live drift setup.

Can I revoke access later?

Yes. Delete the IAM user or access key (Method 2), or delete the role (Method 1), and InfraSync immediately loses access — account-wide, no leftover secrets.

What is an external ID and why does it matter?

It is a value InfraSync generates for your account and presents whenever it assumes your role. Your trust policy requires it, so the role cannot be assumed without it — even by InfraSync's own account. It closes the confused deputy problem, where a third party could otherwise be tricked into using its access on someone else's behalf.

#aws#iam#onboarding#cross-account-role#read-only#getting-started

Keep reading

Guide · Security

How to Create a Read-Only IAM Role for Safe AWS Scanning

Least-privilege roles, cross-account trust, and external IDs — done right.

Read the guide ›

Guide · Terraform

How to Generate Terraform from an Existing AWS Account

The four real ways to reverse-engineer a live account into Terraform — with code and trade-offs.

Read the guide ›
Linxus Infotech

Live AWS infrastructure, codified as production-grade Terraform. Maker of InfraSync.

support@linxusinfotech.com
+91 8828 757 008

Product

  • InfraSync app
  • Features
  • How it works
  • Pricing
  • Compare
  • Blog

Legal

  • Privacy policy
  • Terms & conditions
  • Acceptable use policy
  • Security
  • Cookie policy
  • Cancellation & refunds
  • Service level agreement
  • Shipping & delivery
  • Contact us

Company

  • Try InfraSync
  • Contact sales
  • Support
  • Sitemap

© 2026 Linxus Infotech Pvt. Ltd. All rights reserved.

Made for engineers who refuse to click things in production.