Connect a Member Account

In this guide, you will enable resource-level governance for an AWS member account by deploying an IAM role to it, telling Guardrails how to assume that role, and raising the account's discovery level to Resource.

When you connect an AWS Organization, member accounts come in at Account discovery level: Guardrails sees each account and evaluates organization-level policies, but doesn't discover the resources inside them. Turning on full discovery for an account is a deliberate, per-account action so you control your API footprint and cost. This guide walks the three settings that do it.

[!IMPORTANT] Do this per-account, from policy settings, rather than re-running the Create Connection wizard. Re-walking the wizard raises every already-imported account to full resource discovery, which you almost certainly don't want.

Prerequisites

How It Works

Three things have to line up for Guardrails to discover a member account's resources:

  1. An IAM role in the member account that trusts the Guardrails deployment account and is gated by an External ID. You deploy this with a CloudFormation StackSet.
  2. Default credential policies on the organization that tell Guardrails which role name to assume and which External ID to send. Guardrails reads these when it assumes the role.
  3. A discovery level of Resource on the account (or its parent OU), which switches on resource discovery.

Deploy the role first. If you set the credential policies before the role exists, Guardrails will attempt to assume a role that isn't there and log failed attempts until you finish.

Step 1: Deploy the Member Account IAM Role

Deploy an IAM role to the target account using a CloudFormation StackSet from your Organization management account. Two templates are provided below. Start with the read-only template unless you specifically need Guardrails to remediate.

The External ID is a shared secret that gates role assumption. You choose the value: any string of 8 to 64 characters works, as long as it's identical in the template's trust policy (here) and in the credential policy you set in Step 2. Pick one now and use it in both places.

[!NOTE] If your workspace sets AWS > Account > Turbot IAM Role > External ID > Protection to Protected, the value must start with turbot-<your Turbot root ID>-, matching the format the wizard generates (for example, turbot-1234567890123-a1b2c3d4). The default is Open, which accepts any value. If you'd rather not choose your own, the Create Connection screen (Dashboard > CONNECT > AWS > AWS Organization) generates a correctly-formatted External ID and pre-fills a downloadable copy of this template with your Guardrails account ID. Downloading the template connects nothing; close the wizard without finishing it.

Read-only template (recommended)

Grants ReadOnlyAccess plus the CloudWatch Events and SNS permissions Guardrails needs for real-time event handling. No write access, so Guardrails discovers and evaluates but cannot change resources.

Replace <YOUR_GUARDRAILS_ACCOUNT_ID> and <YOUR_EXTERNAL_ID> with your values (see Trusted Account ID below for the account ID).

AWSTemplateFormatVersion: '2010-09-09'
Description: |
  Turbot Guardrails IAM Role for Organization Connection Accounts.
  Deploy this template as a CloudFormation StackSet to create IAM roles
  across all accounts in your AWS Organization.

Parameters:
  GuardrailsAccountId:
    Type: String
    Default: '<YOUR_GUARDRAILS_ACCOUNT_ID>'
    Description: AWS Account ID where Turbot Guardrails is running

  ExternalId:
    Type: String
    Default: '<YOUR_EXTERNAL_ID>'
    Description: External ID for role assumption security
    MinLength: 8
    MaxLength: 64

  RoleName:
    Type: String
    Default: 'turbot_guardrails_member_account'
    Description: Name of the IAM role to create in accounts

Resources:
  GuardrailsConnectionRole:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Ref RoleName
      Description: IAM role for Turbot Guardrails read-only access (connection account)
      MaxSessionDuration: 43200
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Principal:
              AWS: !Sub 'arn:aws:iam::${GuardrailsAccountId}:root'
            Action: sts:AssumeRole
            Condition:
              StringEquals:
                sts:ExternalId: !Ref ExternalId
      ManagedPolicyArns:
        - arn:aws:iam::aws:policy/ReadOnlyAccess
      Tags:
        - Key: turbot:managed
          Value: 'true'
        - Key: turbot:purpose
          Value: guardrails-connection-access

  GuardrailsEventsPolicy:
    Type: AWS::IAM::Policy
    Properties:
      PolicyName: TurbotGuardrailsEventsAccess
      PolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Sid: CloudWatchEventsAccess
            Effect: Allow
            Action:
              - events:DeleteRule
              - events:DescribeRule
              - events:DisableRule
              - events:EnableRule
              - events:ListRules
              - events:ListTargetsByRule
              - events:PutRule
              - events:PutTargets
              - events:RemoveTargets
            Resource:
              - !Sub 'arn:aws:events:*:${AWS::AccountId}:rule/turbot_*'
          - Sid: SNSAccess
            Effect: Allow
            Action:
              - sns:AddPermission
              - sns:CreateTopic
              - sns:DeleteTopic
              - sns:GetTopicAttributes
              - sns:ListSubscriptionsByTopic
              - sns:ListTopics
              - sns:Publish
              - sns:RemovePermission
              - sns:SetTopicAttributes
              - sns:Subscribe
              - sns:Unsubscribe
            Resource:
              - !Sub 'arn:aws:sns:*:${AWS::AccountId}:turbot_*'
      Roles:
        - !Ref GuardrailsConnectionRole

  EventHandlerRole:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub '${RoleName}_events'
      Description: IAM role for Guardrails CloudWatch Events (member account)
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Principal:
              Service: events.amazonaws.com
            Action: sts:AssumeRole
      Policies:
        - PolicyName: EventsToSNS
          PolicyDocument:
            Version: '2012-10-17'
            Statement:
              - Effect: Allow
                Action:
                  - sns:Publish
                Resource:
                  - !Sub 'arn:aws:sns:*:${AWS::AccountId}:turbot_*'
      Tags:
        - Key: turbot:managed
          Value: 'true'
        - Key: turbot:purpose
          Value: guardrails-events

Outputs:
  ConnectionRoleArn:
    Description: ARN of the Guardrails connection access role
    Value: !GetAtt GuardrailsConnectionRole.Arn

  ConnectionRoleExternalId:
    Description: External ID for role assumption
    Value: !Ref ExternalId

  EventHandlerRoleArn:
    Description: ARN of the event handler role
    Value: !GetAtt EventHandlerRole.Arn
Full remediation template (AdministratorAccess)

[!WARNING] This template attaches AdministratorAccess to the Guardrails role, granting full read/write access to the account. Only use it when you want Guardrails to automatically remediate policy violations, and make sure the External ID and trust policy are correct before deploying.

Replace <YOUR_GUARDRAILS_ACCOUNT_ID> and <YOUR_EXTERNAL_ID> with your values.

AWSTemplateFormatVersion: '2010-09-09'
Description: |
  Turbot Guardrails IAM Role for Organization Connection Accounts.
  Deploy this template as a CloudFormation StackSet to create IAM roles
  across all accounts in your AWS Organization.

Parameters:
  GuardrailsAccountId:
    Type: String
    Default: '<YOUR_GUARDRAILS_ACCOUNT_ID>'
    Description: AWS Account ID where Turbot Guardrails is running

  ExternalId:
    Type: String
    Default: '<YOUR_EXTERNAL_ID>'
    Description: External ID for role assumption security
    MinLength: 8
    MaxLength: 64

  RoleName:
    Type: String
    Default: 'turbot_guardrails_member_account'
    Description: Name of the IAM role to create in accounts

Resources:
  GuardrailsConnectionRole:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Ref RoleName
      Description: IAM role for Turbot Guardrails full remediation access (connection account)
      MaxSessionDuration: 43200
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Principal:
              AWS: !Sub 'arn:aws:iam::${GuardrailsAccountId}:root'
            Action: sts:AssumeRole
            Condition:
              StringEquals:
                sts:ExternalId: !Ref ExternalId
      ManagedPolicyArns:
        - arn:aws:iam::aws:policy/AdministratorAccess
      Tags:
        - Key: turbot:managed
          Value: 'true'
        - Key: turbot:purpose
          Value: guardrails-connection-access

Outputs:
  ConnectionRoleArn:
    Description: ARN of the Guardrails connection access role
    Value: !GetAtt GuardrailsConnectionRole.Arn

  ConnectionRoleExternalId:
    Description: External ID for role assumption
    Value: !Ref ExternalId

Trusted Account ID

Set GuardrailsAccountId to the AWS account where your Guardrails workspace runs. This is the principal the member role trusts.

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

Deploy the StackSet

Deploy the template to the target member account from your Organization management account. You can use the AWS Console or the AWS CLI; both achieve the same result.

Option A: Deploy via the AWS Console (StackSet)
  1. Open the AWS CloudFormation console in your management account and navigate to StackSets > Create StackSet.

  2. On the Choose a template page, keep Service-managed permissions and Template is ready selected. Under Template source, select Upload a template file and upload the template. Click Next.

  3. On the Specify StackSet details page, enter a StackSet name (for example, turbot-guardrails-member-access). Confirm the parameters (GuardrailsAccountId, ExternalId, and RoleName) are filled in with your values.

    CloudFormation StackSet Step 2 showing StackSet name and the Guardrails template parameters

    Click Next.

  4. On the Configure StackSet options page, check the IAM capabilities acknowledgment ("I acknowledge that AWS CloudFormation might create IAM resources with custom names"). Click Next.

  5. On the Set deployment options page:

    • Select Deploy to organizational units (OUs).
    • Enter the AWS OU ID that contains your target account, or the org root.
    • Set Account filter type to Intersection and enter the account number to deploy to just that account.
    • Under Specify Regions, add a single region such as US East (N. Virginia) (us-east-1). IAM roles are global, so one region is enough.
    • Click Next, review the summary, then click Submit.
  6. Wait for the operation status to show SUCCEEDED.

    CloudFormation StackSet Operations tab showing CREATE operation with SUCCEEDED status

Option B: Deploy via the AWS CLI

Run from your management account. Replace the OU ID and account number with your values.

# Create the StackSet
aws cloudformation create-stack-set \
  --stack-set-name turbot-guardrails-member-access \
  --template-body file://turbot_guardrails_member_account.yaml \
  --permission-model SERVICE_MANAGED \
  --auto-deployment Enabled=true,RetainStacksOnAccountRemoval=false \
  --capabilities CAPABILITY_NAMED_IAM

# Deploy to a specific account
aws cloudformation create-stack-instances \
  --stack-set-name turbot-guardrails-member-access \
  --deployment-targets OrganizationalUnitIds='["ou-xxxx-xxxxxxxx"]',AccountFilterType=INTERSECTION,Accounts='["123456789012"]' \
  --regions us-east-1

Wait for the operation to complete:

aws cloudformation describe-stack-set-operation \
  --stack-set-name turbot-guardrails-member-access \
  --operation-id <operation-id-from-output>

The operation status should show SUCCEEDED.

Step 2: Set the Default Credential Policies

Now tell Guardrails how to assume the role you just deployed. Set two policies on your AWS Organization: the role name to assume and the External ID to send with the assume-role request. Setting them on the organization lets every member account inherit the values.

Navigate to your AWS Organization in Guardrails, open the Policies tab, and create a new setting for each policy below. Search for the policy by name, click New Policy Setting, enter the value, and click Create.

AWS > Account > Turbot IAM Role > Name [Default]

Set this to the role name from your template. If you kept the default, the value is turbot_guardrails_member_account.

New Policy Setting form for AWS Account Turbot IAM Role Name Default with the value turbot_guardrails_member_account

AWS > Account > Turbot IAM Role > External ID [Default]

Set this to the same External ID you put in the template's trust policy in Step 1. This is the value Guardrails sends in the sts:AssumeRole request; it must match the role's trust policy exactly, or the assume-role fails.

New Policy Setting form for AWS Turbot IAM Role External ID Default with the External ID value

Step 3: Raise the Account's Discovery Level

With the role deployed and the credential policies set, switch on resource discovery for the account.

Navigate to your AWS Organization and open the AWS > Organization > Discovery Level policy setting. This is an array: each entry maps an account or OU to a discovery level. Add an entry for your target account (or its OU) with discoveryLevel: resource, alongside the existing organization-wide entry.

Edit Policy Setting for AWS Organization Discovery Level showing the array editor with an account set to resource discovery

- aka: r-ntlu                 # existing org-root entry, keep it
  discoveryLevel: account
- aka: "123456789012"         # your target account (or an OU aka)
  discoveryLevel: resource
Discovery LevelDescription
noneAccount is excluded from Guardrails. No discovery or governance.
accountGuardrails sees the account and evaluates organization-level policies. No resource discovery.
resourceFull resource-level governance: discovery, runtime controls, and remediation. Requires the IAM role and credential policies from Steps 1 and 2.

Click Update to save. Setting resource triggers Guardrails to assume the role and start discovering.

Verify

Guardrails begins discovering the account's resources within a few minutes. Navigate to the account in Guardrails (Resources, then drill into the account) and confirm the resource count climbs above the single account resource it started with.

Account resource page showing the member account discovered with 134 resources across the account

[!NOTE] Full discovery can take several minutes depending on the number of resources. Watch progress on the account's Activity tab.

Troubleshooting

IssueSolution
Account stays at 1 resource after setting resourceConfirm the IAM role exists in the target account and that the credential policies' role name and External ID exactly match the deployed role's trust policy.
AccessDenied / assume-role failures in activityThe External ID in Turbot IAM Role > External ID [Default] doesn't match the role's trust policy, or the role's trusted account ID isn't your Guardrails account.
StackSet deployment failedCheck the CloudFormation StackSet events. Common causes: the role name already exists in the account, or the management account lacks Organizations permissions.
Resources discovered but controls stuck in tbdWait for policy values to clear first, then rerun controls. See Connect an Individual Account.
Further assistanceOpen a Support Ticket

Next Steps