Set up an AWS IAM role
To allow Fluid Attacks to access your CodeCommit repositories, you must create an IAM role that grants cross-account access.
The process involves three steps:
- Obtain the external ID that Fluid Attacks generates for your organization. To do this, access the platform , navigate to Credentials > Add credentials > Add manually and choose AWS Role as credentials type.
- Create the IAM role using that external ID as a shared secret to verify that role assumption requests originate from Fluid Attacks.
- Provide the role’s Amazon Resource Name (ARN) in the Fluid Attacks platform.
If your organization manages multiple AWS accounts, you can create this role in as many accounts as needed. Simply provide the corresponding ARN when adding credentials in the platform.
You can set up the role using either of the following methods:
Manual configuration from AWS Management Console
Follow these steps to create the required role through the AWS user interface:
-
Sign in to the AWS Management Console using an account with permissions to create IAM roles and attach policies.
-
Use the search bar to locate the IAM service and select it.

-
In the IAM Dashboard, select Roles from the left sidebar menu.

-
Click the Create role button.

-
In the Trusted entity type section, select Custom trust policy.

-
In the code editor that appears below, paste the following JSON policy:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "FluidAttacksAccess", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": "sts:AssumeRole", "Condition": { "ArnEquals": { "aws:PrincipalArn": "arn:aws:iam::205810638802:role/prod_integrates" }, "StringEquals": { "sts:ExternalId": "<YOUR-EXTERNAL-ID>" } } } ] }Replace
<YOUR-EXTERNAL-ID>with the external ID that Fluid Attacks generated for your organization.Trust policy breakdown:
The trust policy above contains four key elements:
- Principal (
"AWS": "*"): Although this field allows any AWS account to assume the role, the conditions below restrict actual access. - Action (
sts:AssumeRole): This action permits external entities to assume the role. - Condition (
aws:PrincipalArn): This condition restricts role assumption exclusively to Fluid Attacks’ production role (arn:aws:iam::205810638802:role/prod_integrates). - Condition (
sts:ExternalId): This shared secret between Fluid Attacks and your organization verifies that assumption requests genuinely originate from Fluid Attacks, preventing unauthorized access.
- Principal (
-
Click Next to proceed to the permissions configuration. You may select the ReadOnlyAccess permission, ++but++ Step 8 shows you a recommended user-managed policy used to clone CodeCommit repositories.

-
Create or attach a policy that grants access to your CodeCommit repositories. To follow the principle of least privilege, this is the policy Fluid Attacks recommends:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "CodeCommitAccess", "Effect": "Allow", "Action": ["codecommit:Get*", "codecommit:GitPull"], "Resource": ["<REPO-ARN>"] } ] }Replace
<REPO-ARN>with the actual ARN of your repository. To grant access to multiple repositories, add their ARNs to theResourcearray. -
Click Next to review your role configuration.
-
Provide a name for the role (e.g.,
FluidAttacksCodeCommit) and add a description.
-
Click Create role to finish the setup.
-
Locate your new role in the IAM roles list and click on it to view its details.
-
Copy the ARN (Amazon Resource Name) displayed at the top of the role summary. You need this value to complete the configuration in the Fluid Attacks platform.

Use AWS CloudFormation templates
You can automate the role creation process using AWS CloudFormation. This method is ideal for infrastructure-as-code workflows and multi-account deployments.
First, create the template, then, deploy it using either of the following options:
Create the CloudFormation template
-
Create a new file with a .yaml extension.
-
Copy the following CloudFormation template into the file:
Resources: CodeCommitAccessRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Effect: Allow Action: - "sts:AssumeRole" Principal: AWS: - "*" Condition: ArnEquals: aws:PrincipalArn: "arn:aws:iam::205810638802:role/prod_integrates" StringEquals: sts:ExternalId: "<YOUR-EXTERNAL-ID>" Description: Role to grant Fluid Attacks access to CodeCommit repositories ManagedPolicyArns: - arn:aws:iam::aws:policy/AWSCodeCommitReadOnly RoleName: FluidAttacksCodeCommit -
Replace
<YOUR-EXTERNAL-ID>with the external ID that Fluid Attacks generated for your organization. -
Save the file.
This template uses the AWSCodeCommitReadOnly managed policy for simplicity.
Deploy using the AWS CLI
-
Install the AWS CLI if you have not already done so.
-
Configure your security credentials (
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY) for a user with permissions to create CloudFormation stacks and IAM resources. -
Run the following command to deploy the stack:
aws cloudformation deploy --template-file <path/to/template.yaml> \ --stack-name <stack-name> \ --capabilities CAPABILITY_NAMED_IAMReplace
<path/to/template.yaml>with the path to your template file and<stack-name>with a descriptive name (e.g.,fluid-attacks-codecommit). -
After the deployment completes, retrieve the role ARN by running this:
aws iam get-role --role-name "FluidAttacksCodeCommit"The command returns a JSON response containing the role details, including the ARN.
Deploy using the AWS Management Console
-
Sign in to the AWS Management Console using an account with permissions to perform read and write operations for CloudFormation and IAM resources.
-
Use the search bar to locate the CloudFormation service and select it.

-
In the CloudFormation Dashboard, click the Create stack dropdown and select With new resources (standard).

-
Under Prerequisite - Prepare template, select Template is ready and, under Specify template, select Upload a template file, then click Choose file and select the template you created.

-
Click Next to proceed.
-
Enter a name for the stack and click Next.

-
On the Configure stack options page, you can leave the default settings. Click Next.
-
On the review page, scroll to the Capabilities section at the bottom and check the box acknowledging that CloudFormation may create IAM resources with custom names.

-
Click Submit to begin the deployment and wait for the stack status to show
CREATE_COMPLETE. -
Navigate to the Resources tab and click the Physical ID link for the role resource. This redirects you to the IAM Dashboard.
-
Copy the ARN from the role summary to use in the Fluid Attacks platform.
Troubleshooting
If you encounter issues when adding your AWS environment to the Fluid Attacks platform, verify the following:
- Role permissions:
Confirm that the role has the AWSCodeCommitReadOnly
managed policy attached,
or that your custom policy includes the
codecommit:Get*andcodecommit:GitPullactions for the target repositories. - External ID: Ensure that the external ID in your role’s trust policy matches the external ID assigned to your organization by Fluid Attacks. A mismatch will cause role assumption to fail.
- Repositories encrypted with custom AWS KMS Customer Managed Keys (CMK)
may fail to clone with authentication errors(
403). This occurs because custom KMS keys require explicit decrypt permissions that must be configured for both the CodeCommit service and individual users attempting to clone the repository, solutions:- Switch to AWS Managed Keys: Change your repository encryption settings to use the default AWS managed key (aws/codecommit). This automatically handles all necessary permissions.
- If using custom CMK:
Ensure your KMS key policy grants decrypt permissions to CodeCommit
and IAM users have
kms:Decrypton the key. See AWS KMS Key Policies.