Connect AWS to StackGuardian
Overview
StackGuardian provides three main approaches for authenticating your workloads or running discovery against an AWS account:
- AWS RBAC Role
- OIDC Identity Provider (recommended)
- Access Key
AWS RBAC Role
This method uses cross-account IAM role assumption with an External ID. It is the recommended approach for securely granting StackGuardian access to your AWS account without storing long-lived credentials.
A pre-configured CloudFormation template can be used to create an IAM role with custom or AWS managed policies. This allows for the role and policy to be set up without accessing the StackGuardian platform.
For EU Region: Create IAM Role with CloudFormation
For US Region: Create IAM Role with CloudFormation
Contact your StackGuardian representative if you're unsure which region to use.
Step 1. Create an IAM Role in AWS
- Sign in to the AWS Management Console and navigate to IAM → Roles → Create role.
- Select Custom trust policy as the trusted entity type.
- Replace the contents of the trust policy editor with the following, substituting your own External ID:
The External ID must follow the format
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::476299211833:root",
"arn:aws:iam::163602625436:root"
]
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "<org-name>:<random-string>"
}
}
}
]
}<org-name>:<random-string>— for example,myorg:abc12345. - Click Next and assign the required permissions policy:
- For discovery/read-only access: attach
ReadOnlyAccess - For deployment access: attach permissions tailored to the resources StackGuardian will manage
- For discovery/read-only access: attach
- Give the role a descriptive name such as
StackGuardianIntegrationRole, then click Create Role. - Copy the Role ARN — you will need it in the next step.
Step 2. Create the Connector in StackGuardian
-
In StackGuardian, navigate to Connectors → Cloud Providers.
-
Click Connect with Cloud Provider.
-
Add a Connector name.
-
Input the Role ARN and External ID from Step 1.
-
Click Create to finalize the connector.
OIDC Identity Provider (recommended)
This method uses OpenID Connect (OIDC) federation to allow StackGuardian to authenticate to AWS using temporary credentials — no long-lived secrets required.
For US Region, use https://api.us.stackguardian.io as Provider URL and Audience.
Step 1. Create an OIDC Identity Provider in AWS
- In the AWS Management Console, go to IAM → Identity Providers → Add provider.
- Select OpenID Connect as the provider type.
- Enter the Provider URL and Audience based on your region:
- For EU Region:
https://api.app.stackguardian.io - For US Region:
https://api.us.stackguardian.io
- For EU Region:
- Click Add provider.
Step 2. Create an IAM Role for the OIDC Provider
- In IAM → Roles → Create role, select Web Identity as the trusted entity type.
- Choose the identity provider you just created
- For EU Region:
https://api.app.stackguardian.io - For US Region:
https://api.us.stackguardian.io
- For EU Region:
- Select the audience:
- For EU Region:
https://api.app.stackguardian.io - For US Region:
https://api.us.stackguardian.io
- For EU Region:
- Assign the required permissions:
- For discovery/read-only access: attach
ReadOnlyAccess - For deployment access: attach the least permissions required for your use case
- For discovery/read-only access: attach
- Name the role and click Create Role.
- Copy the Role ARN — you will need it for the final step.
Step 3. Update the Trust Policy
Navigate to your newly created role → Trust relationships → Edit trust policy and apply the following, replacing the placeholder values:
- EU Region
- US Region
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::<YOUR_AWS_ACCOUNT_ID>:oidc-provider/api.app.stackguardian.io"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"api.app.stackguardian.io:aud": "https://api.app.stackguardian.io"
},
"StringLike": {
"api.app.stackguardian.io:sub": "/orgs/<YOUR_SG_ORG>"
}
}
}
]
}
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::<YOUR_AWS_ACCOUNT_ID>:oidc-provider/api.us.stackguardian.io"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"api.us.stackguardian.io:aud": "https://api.us.stackguardian.io"
},
"StringLike": {
"api.us.stackguardian.io:sub": "/orgs/<YOUR_SG_ORG>"
}
}
}
]
}
- Replace
<YOUR_AWS_ACCOUNT_ID>with your AWS account ID. - Replace
<YOUR_SG_ORG>with your StackGuardian organization name.
Step 4. Create the Connector in StackGuardian
- In StackGuardian, navigate to Connectors → Cloud Providers.
- Click Connect with Cloud Provider.
- Add a Connector name.
- Input the Role ARN from Step 2.
- Click Create to finalize the connector.
Access Key
This method uses a static AWS access key and secret. It is the simplest method but the least recommended, as it involves long-lived credentials.
Step 1. Create an IAM User in AWS
- In the AWS Management Console, navigate to IAM → Users → Create user.
- Provide a username (e.g.,
stackguardian-user). - Select Access key - Programmatic access as the AWS access type.
- Attach the necessary policies to allow StackGuardian to manage your AWS infrastructure:
- For discovery/read-only access: attach
ReadOnlyAccess - For deployment access: attach the least permissions required for your use case
- For discovery/read-only access: attach
- Complete the user creation and copy the generated Access Key ID and Secret Access Key — these will not be shown again.
Step 2. Create the Connector in StackGuardian
- In StackGuardian, navigate to Connectors → Cloud Providers.
- Click Connect with Cloud Provider.
- Add a Connector name.
- Provide the following values:
- Access Key ID
- Secret Access Key
- Default AWS Region
- Click Create to finalize the connector.
Group Connector
Group Connectors allow you to connect multiple AWS accounts at once instead of creating individual connectors — ideal for organizations managing large numbers of accounts.
Step 1. Begin Group Connector Setup
- Log in to the StackGuardian Platform and navigate to Connectors → Cloud Providers.
- Click Connect with Cloud Provider.
- In the connectors modal, select Connect Multiple Accounts (Preview).
- Choose your preferred connection method: Roles or RBAC (recommended) or Access Keys.
Step 2. Configure the Group
- Enter a Connector Group Name and Description (e.g., "Enterprise AWS Accounts").
- Provide the AWS Role ARN and External ID for the management role.
- Ensure the External ID matches the format
<org-name>:<random-string>or<org-name>-<random-string> - Leave Require MFA disabled
- Ensure the External ID matches the format
- Click Next (Preview).
Step 3. Select AWS Accounts
- In the List of Accounts in AWS Org section, use the Choose accounts dropdown to select individual accounts or click Select All.
- The list will include each account's Email and Account ID.
- Click Next (Preview).
Step 4. Configure Global Settings and Individual Accounts
- Under Global Settings, set the IAM Role Name and AWS Default Region — these apply to all connected accounts.
- Under Configure Accounts, fill in the following for each account:
- AWS Connector Name — a brief name for the connector
- Description — a short description of the account's purpose
- AWS Role ARN — the role ARN for that account
- External ID — the external ID associated with the role
- Credential validity in seconds — the desired duration for temporary credentials
- Click Add All (Preview) to complete the setup.
Once created, click the Group Connector card to access and edit the configuration for any individual account within the group.