Connect an Individual Account

In this guide, you will import a single AWS account into Guardrails using the Create Connection wizard.

[!TIP] For multi-account environments, connecting your AWS Organization is the recommended approach. It discovers all member accounts automatically, lets you set discovery levels per-account, and supports deploying IAM roles via StackSet. Individual account import is best for standalone accounts not part of an organization.

Prerequisites

[!IMPORTANT] Free Tier AWS accounts cannot be used with Guardrails. They lack the API limits needed for resource discovery.

Supported Partitions

PartitionNameAuthentication
awsCommercialCross-account IAM role (default)
aws-us-govGovCloudIAM access key pair, see GovCloud guide
aws-cnChinaIAM access key pair, see GovCloud guide

Step 1: Open the Create Connection Wizard

From the Dashboard, select the CONNECT button in the top right (or from Workspace > Accounts, select Import). Select AWS from the provider grid, then choose AWS Account.

The wizard walks you through connectivity settings, a connection test, choosing a destination folder, and a final review.

Step 2: Configure Connectivity Settings

Add AWS Connection wizard showing Connectivity Settings with AWS Partition, Access Type, Permission Features toggles, and role configuration fields

AWS Partition

Select your AWS partition. The default is Commercial (aws).

Access Type

TypeDescription
IAM Role (recommended)Cross-account role assumption. Guardrails assumes a role in your account using the Guardrails host account as the trusted principal.
Access KeyIAM access key pair. Required for cross-partition imports (GovCloud, China).

Permission Features

Toggle the capabilities you need:

FeatureDescription
Enable Realtime Events (recommended)Includes CloudWatch Events and SNS permissions in the IAM role so Guardrails can receive real-time change notifications.
Enable Runtime RemediationGrants AdministratorAccess so Guardrails can automatically fix policy violations.

The Required Permissions summary updates based on your selections:

Step 3: Configure the IAM Role

Role configuration section showing Role Name, External ID with copy/lock/regenerate controls, Role ARN field, and Deploy IAM Role template downloads

FieldDescription
Role NameThe IAM role name (default: turbot_guardrails). Must match the role you create in your AWS account.
External IDAuto-generated unique ID for the trust policy. Copy this value. You'll need it when creating the role. Click the lock icon to use a custom value.
Role ARNThe full ARN of the IAM role (e.g., arn:aws:iam::123456789012:role/turbot_guardrails). Enter this after creating the role.

Deploy the IAM Role

Click CloudFormation Template or Terraform Template to download a pre-configured template with your settings (partition, role name, External ID, and permissions) already filled in. Deploy this template in your AWS account to create the role.

CloudFormation deployment
  1. Open the AWS CloudFormation console in the target account.
  2. Select Create Stack > With new resources.
  3. Upload the downloaded template.
  4. Enter a stack name (e.g., turbot-guardrails-access).
  5. Review parameters (pre-filled) and click Next through to Submit.
  6. Wait for CREATE_COMPLETE.
AWS CLI deployment
aws cloudformation create-stack \
  --stack-name turbot-guardrails-access \
  --template-body file://guardrails-access-role-template.yaml \
  --capabilities CAPABILITY_NAMED_IAM

Wait for completion:

aws cloudformation wait stack-create-complete \
  --stack-name turbot-guardrails-access

After deploying, copy the Role ARN from the CloudFormation stack outputs and paste it into the Role ARN field.

Step 4: Test the Connection

After you enter the Role ARN, click Continue. The wizard assumes the role from the Guardrails host account to confirm access. On success, you'll see Connection Successful! with the verified account ID and the assumed-role identity.

Test Connection step showing Connection Verified with the account ID and assumed-role identity

Click Continue to proceed.

[!NOTE] If the test fails, the External ID or Role ARN doesn't match the deployed role, or the role's trust policy doesn't trust the Guardrails host account. See Cross-Account Trust.

Step 5: Choose a Destination Folder

Select where the account should live in your Guardrails resource hierarchy, then click Continue. Use Create Folder if you want a new location.

Step 6: Review and Connect

Review the destination folder, connectivity settings, and connection test result, then click Connect AWS Account.

Guardrails creates the account resource and begins discovering resources. Discovery typically takes a few minutes; CMDB and Discovery controls are enabled by default.

Imported account resource page showing discovered resources under Turbot > AWS

What Permissions to Grant

The Permission Features toggles determine the CloudFormation template content. If you're creating the role manually:

Use CasePermissions
Full remediationarn:aws:iam::aws:policy/AdministratorAccess
Read-only + global event handlersReadOnlyAccess + custom policy for EventBridge/SNS (see CloudFormation templates)
Read-only + regional event handlersReadOnlyAccess + custom policy for EventBridge/SNS scoped to turbot_aws_api_events* and turbot_aws_api_handler*
Mixed remediationReadOnlyAccess + AmazonSNSFullAccess + CloudWatchEventsFullAccess + service-specific policies as needed
Budget monitoringAdd ce:GetCostForecast and ce:GetCostAndUsage

Cross-Account Trust

The role's trust policy must allow the Guardrails host account to assume it:

EnvironmentTrusted Account ID
Turbot Cloud (US)287590803701
Turbot Cloud (EU)255798382450
EnterpriseYour Guardrails installation account ID

External ID

The External ID prevents the confused deputy problem. Guardrails auto-generates one unique to your workspace. When External ID Protection is set to Protected, you must use the auto-generated format.

CloudFormation Templates

The wizard generates these automatically based on your Permission Features selections. For reference, here are the templates for manual use:

ReadOnly + Global Event Handlers (recommended)
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
  AccessRoleName:
    Type: String
    Default: turbot_guardrails
  AccessPolicyName:
    Type: String
    Default: turbot_guardrails_access_policy
  AccessRoleExternalId:
    Type: String
    Description: The External ID from your Guardrails workspace
  EventHandlerRoleName:
    Type: String
    Default: turbot_guardrails_events_role
  GuardrailsIamPath:
    Type: String
    Default: "/"
  GuardrailsAccountId:
    Type: String
    Default: '287590803701'
Resources:
  GuardrailsAccessRole:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              AWS: !Sub "arn:aws:iam::${GuardrailsAccountId}:root"
            Action: "sts:AssumeRole"
            Condition:
              StringEquals:
                "sts:ExternalId": !Ref AccessRoleExternalId
      Path: !Ref GuardrailsIamPath
      ManagedPolicyArns:
        - "arn:aws:iam::aws:policy/ReadOnlyAccess"
      RoleName: !Ref AccessRoleName
  GuardrailsAccessPolicy:
    Type: "AWS::IAM::Policy"
    Properties:
      PolicyName: !Ref AccessPolicyName
      Roles:
        - !Ref AccessRoleName
      PolicyDocument:
        Version: 2012-10-17
        Statement:
          - Sid: PassRoleToAWS
            Effect: Allow
            Action:
              - "iam:PassRole"
              - "iam:GetRole"
            Resource:
              - !GetAtt EventHandlersGlobalRole.Arn
          - Sid: TurbotEvents
            Effect: Allow
            Action:
              - "events:PutEvents"
              - "events:EnableRule"
              - "events:DisableRule"
              - "events:PutRule"
              - "events:DeleteRule"
              - "events:PutTargets"
              - "events:RemoveTargets"
              - "events:TagResource"
              - "events:UntagResource"
            Resource:
              - !Sub "arn:aws:events:*:${AWS::AccountId}:rule/turbot_aws_api_events*"
          - Sid: TurbotSNS
            Effect: Allow
            Action:
              - "sns:TagResource"
              - "sns:UntagResource"
              - "sns:CreateTopic"
              - "sns:DeleteTopic"
              - "sns:SetTopicAttributes"
              - "sns:Publish"
              - "sns:Subscribe"
              - "sns:ConfirmSubscription"
              - "sns:AddPermission"
              - "sns:RemovePermission"
              - "sns:Unsubscribe"
            Resource:
              - !Sub "arn:aws:sns:*:${AWS::AccountId}:turbot_aws_api_handler*"
              - !Sub "arn:aws:sns:*:${AWS::AccountId}:turbot_aws_api_handler*:*"
    DependsOn:
      - GuardrailsAccessRole
  EventHandlersGlobalRole:
    Type: 'AWS::IAM::Role'
    Properties:
      RoleName: !Ref EventHandlerRoleName
      Path: !Ref GuardrailsIamPath
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              Service: "events.amazonaws.com"
      Policies:
        - PolicyName: "aws_api_events_policy"
          PolicyDocument:
            Version: "2012-10-17"
            Statement:
              - Effect: "Allow"
                Action: "events:PutEvents"
                Resource: !Sub "arn:aws:events:*:${AWS::AccountId}:event-bus/default"
Full AdministratorAccess
AWSTemplateFormatVersion: "2010-09-09"
Parameters:
  RoleName:
    Type: String
    Default: turbot_guardrails
  TurbotAccountId:
    Type: String
    Default: 287590803701
  TurbotExternalId:
    Type: String
    NoEcho: True
    MinLength: 1
Resources:
  TurbotSuperuserRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: Allow
            Principal:
              AWS: !Sub arn:aws:iam::${TurbotAccountId}:root
            Action: sts:AssumeRole
            Condition:
              StringEquals:
                sts:ExternalId: !Ref TurbotExternalId
      Path: /turbot/core/
      ManagedPolicyArns:
        - "arn:aws:iam::aws:policy/AdministratorAccess"
      RoleName: !Ref RoleName

Import via Terraform

resource "turbot_resource" "account" {
  parent   = "id-of-parent-folder"
  type     = "tmod:@turbot/aws#/resource/types/account"
  metadata = jsonencode({
    "aws" : { "accountId" : "123456789012", "partition" : "aws" }
  })
  data = jsonencode({ "Id" : "123456789012" })
}

resource "turbot_policy_setting" "turbotIamRole" {
  resource = turbot_resource.account.id
  type     = "tmod:@turbot/aws#/policy/types/turbotIamRole"
  value    = "arn:aws:iam::123456789012:role/turbot_guardrails"
}

resource "turbot_policy_setting" "turbotIamRoleExternalId" {
  resource = turbot_resource.account.id
  type     = "tmod:@turbot/aws#/policy/types/turbotIamRoleExternalId"
  value    = "your-external-id"
}

Post-Import Validation

After importing, verify the account is fully operational:

  1. AWS > Account > CMDB control in ok: confirms the role and permissions work.
  2. Policy values clearing tbd: all policy values should reach ok or skipped. Clear these before checking controls.
  3. Controls clearing tbd: all controls should reach ok, alarm, or skipped.
  4. Event handling: if enabled, AWS > Turbot > Event Handler or AWS > Turbot > Event Poller controls should be ok.

[!TIP] Use the run_controls_batches script with filter --filter "resourceId:'<ARN>' state:tbd" to rerun stuck controls.

Troubleshooting

IssueSolution
CMDB control in errorVerify the Role ARN and External ID. Check the role has at least ReadOnlyAccess.
Access Denied during discoveryThe IAM role lacks permissions for the failing service. Add the required policy.
Controls stuck in TBDWait for policy values to clear first. Use run_controls_batches to rerun.
Further assistanceOpen a Support Ticket