Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

13.9 KB
Raw Blame
---
title: "AWS connection"
sidebarTitle: "AWS"
description: "Learn how to configure an AWS connection for Infisical."
---

import { UseCasePicker, UseCase } from "/snippets/UseCasePicker.jsx";
import { awsUseCaseGroups } from "/snippets/app-connections/aws/use-cases.jsx";
import { CombinedIamPolicy } from "/snippets/AwsIamPolicy.jsx";
import SelfHostedInstance from "/snippets/app-connections/aws/self-hosted-instance.mdx";
import CreateIamRole from "/snippets/app-connections/aws/create-iam-role.mdx";
import CreateIamUser from "/snippets/app-connections/aws/create-iam-user.mdx";
import ConnectionFormFields from "/snippets/app-connections/aws/form-fields.mdx";
import AgentVaultSessionLogsCorsRule from "/snippets/app-connections/aws/agent-vault-session-logs-cors-rule.mdx";

<UseCasePicker prefix="I want the connection to work with" groups={awsUseCaseGroups} />

An AWS connection authenticates Infisical to your AWS account, either by assuming an [IAM role](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html) or with an [IAM user's access keys](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html).

<Note>
    This guide doesn’t configure any behavior—it just authenticates Infisical with AWS. Once the app connection is ready, you can [use it to set up integrations](#step-4-configure-integrations).
</Note>

## Prerequisites

- An AWS account where you can create IAM roles or users and attach policies to them

<UseCase use="pam-recording" hideWhenEmpty>
    - An [Amazon S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html) for PAM session recordings
</UseCase>

<UseCase use="agent-vault-session-logs" hideWhenEmpty>
    - An [Amazon S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html) for Agent Vault session logs
</UseCase>

<UseCase use="private-ca" hideWhenEmpty>
    - An [AWS Private CA](https://docs.aws.amazon.com/privateca/latest/userguide/create-CA.html) for Infisical to issue certificates from
</UseCase>

<UseCase use="acm-public-ca,acme-route53" hideWhenEmpty>
    - A [Route 53 hosted zone](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingHostedZone.html) for the domain you'll issue certificates for
</UseCase>

## Step 1: Create an IAM role or IAM user

Infisical can either assume an IAM role in your account or sign in as an IAM user with an access key. We recommend using an IAM role, since Infisical never holds a long-lived credential for it.

<Tabs>
    <Tab title="Assume Role (Recommended)">
        <SelfHostedInstance />

        <Steps>
            <CreateIamRole externalId="required" />
        </Steps>
    </Tab>
    <Tab title="Access Key">
        <Steps>
            <CreateIamUser />
        </Steps>
    </Tab>
</Tabs>

## Step 2: Add permissions

Next, add the required policies to the IAM role or user from [Step 1](#step-1-create-an-iam-role-or-iam-user):

<Steps>
    <Step>
        In the IAM console, open the IAM role or user.
    </Step>
    <Step>
        On the **Permissions** tab, select **Add permissions** > **Create inline policy**.

        ![IAM Role Create Policy](/images/app-connections/aws/assume-role-create-policy.png)
    </Step>
    <Step>
        Switch to the **JSON** editor, and replace the policy in the editor with this one. It combines the permissions of every integration you picked:

        <CombinedIamPolicy groups={awsUseCaseGroups} />

        <UseCase use="pam-recording,agent-vault-session-logs,private-ca,acm-public-ca,acme-route53" hideWhenEmpty>
            Then replace the placeholders for the integrations you picked:
        </UseCase>

        <UseCase use="pam-recording" hideWhenEmpty>
            - `<recording-bucket>`: the bucket you enter in the **Session Recording** card of a PAM account template (if you set a key prefix, such as `pam/prod`, add it after the bucket in both object ARNs)
        </UseCase>

        <UseCase use="agent-vault-session-logs" hideWhenEmpty>
            - `<session-logs-bucket>` and `<key-prefix>`: the bucket and key prefix you'll enter in the **Session Logs** dialog in Agent Vault (if you won't set a key prefix, delete `<key-prefix>/` in both places)
        </UseCase>

        <UseCase use="private-ca" hideWhenEmpty>
            - `<region>`, `<account-id>`, and `<ca-id>`: the parts of your CA's ARN (to use several CAs, list each ARN in a `Resource` array)
        </UseCase>

        <UseCase use="acm-public-ca,acme-route53" hideWhenEmpty>
            - `<hosted-zone-id>`: the ID of the Route 53 hosted zone for your domain
        </UseCase>

        <UseCase use="private-ca" hideWhenEmpty>
            If you restrict `acm-pca:IssueCertificate` with an `acm-pca:TemplateArn` condition, include every template Infisical uses, or issuance fails with a permission error:

            - `arn:aws:acm-pca:::template/BlankEndEntityCertificate_APICSRPassthrough/V1` for end-entity certificates
            - `arn:aws:acm-pca:::template/SubordinateCACertificate_PathLen{0,1,2,3}_APICSRPassthrough/V1` for [CA certificates](/documentation/platform/pki/ca/aws-pca#issuing-ca-certificates)
        </UseCase>

        <UseCase use="acm-public-ca" hideWhenEmpty>
            If a different AWS account owns the hosted zone for an ACM public CA, move the `AllowRoute53ForAcmValidation` statement to a second connection in that account instead.
        </UseCase>

        <UseCase use="secrets-manager,parameter-store" hideWhenEmpty>
            If a sync encrypts with a customer managed KMS key, select its KMS checkbox above the policy. If that key doesn't use the default key policy, also add the IAM role or user under **Key users** on the key's page in the AWS KMS console.
        </UseCase>

        <UseCase use="secrets-manager,parameter-store,iam-rotation,honey-tokens,acm-sync,elb-sync,pki-secrets-manager,private-ca,acm-public-ca,acme-route53,pam-recording,agent-vault-session-logs" hideWhenEmpty>
            <Warning>
                If you use the **Access Key** method, AWS may reject the policy as too large, because IAM users allow less inline policy than roles do.
                
                In this case, create it as a customer managed policy instead: in the IAM console, go to **Policies** > **Create policy**, paste the same JSON, and save it. Then open the IAM user and attach it under **Add permissions** > **Attach policies directly**.
            </Warning>
        </UseCase>
    </Step>
    <Step>
        Select **Next**. Enter a **Policy name** that says which integrations the policy covers, such as `secrets-manager-sync`. Then, select **Create policy**. The policy belongs to the role or user, which already names Infisical, so the policy name only has to say what the policy grants.
    </Step>
</Steps>

<UseCase use="pam-recording" hideWhenEmpty>
    ### Add a CORS rule for PAM session recording

    Your browser downloads recordings directly from the bucket during playback, so the bucket needs a CORS rule.

    <Steps>
        <Step>
            In the Amazon S3 console, open the recording bucket, go to **Permissions**, and select **Edit** under **Cross-origin resource sharing (CORS)**.
        </Step>
        <Step>
            Paste this rule, then select **Save changes**. If the bucket already has CORS rules, add this rule's object to the existing array instead of replacing it, so other applications that use the bucket keep working:

            <CodeGroup>
                ```json Infisical Cloud (US)
                [
                    {
                        "AllowedHeaders": ["*"],
                        "AllowedMethods": ["GET"],
                        "AllowedOrigins": ["https://app.infisical.com"],
                        "ExposeHeaders": [],
                        "MaxAgeSeconds": 3600
                    }
                ]
                ```

                ```json Infisical Cloud (EU)
                [
                    {
                        "AllowedHeaders": ["*"],
                        "AllowedMethods": ["GET"],
                        "AllowedOrigins": ["https://eu.infisical.com"],
                        "ExposeHeaders": [],
                        "MaxAgeSeconds": 3600
                    }
                ]
                ```
            </CodeGroup>

            If you self-host Infisical or use a dedicated instance, replace `AllowedOrigins` with your instance's URL.
        </Step>
    </Steps>
</UseCase>

<UseCase use="agent-vault-session-logs" hideWhenEmpty>
    ### Add a CORS rule for Agent Vault session logs

    Your browser downloads session logs directly from the bucket, so the bucket needs a CORS rule. To see the same rule with your Infisical URL filled in, select **View AWS Setup** in the **Session Logs** dialog.

    <Steps>
        <AgentVaultSessionLogsCorsRule />
    </Steps>
</UseCase>

## Step 3: Create the app connection

Next, create the app connection in Infisical.

<Tip>
    To create the connection using the API, use the [Create AWS Connection](/api-reference/endpoints/app-connections/aws/create) endpoint.
</Tip>

<View title="Organization-level">
    <Steps>
        <Step>
            In the sidebar, select **Integrations**, then open the **App Connections** tab.

            ![App Connections Tab](/images/app-connections/general/add-connection.png)
        </Step>
        <Step>
            Select **Add Connection** and choose **AWS**.

            ![Select AWS Connection](/images/app-connections/aws/select-aws-connection.png)
        </Step>
        <Step>
            Fill out the form's fields:

            <ConnectionFormFields />

            Then, select **Connect to AWS**.

            ![AWS Connection Form](/images/app-connections/aws/create-assume-role-method.png)
        </Step>
    </Steps>
</View>

<View title="Project-level">
    <Steps>
        <Step>
            Open the project's app connections:

            - **Secrets Management project:** select **Integrations** in the sidebar, then open the **App Connections** tab
            - **Certificate Management project:** select **Settings** in the sidebar, then open the **App Connections** tab
        </Step>
        <Step>
            Select **Add Connection** and choose **AWS**.
        </Step>
        <Step>
            Fill out the form's fields:

            <ConnectionFormFields />

            Then, select **Connect to AWS**.
        </Step>
    </Steps>
</View>

When you select **Connect to AWS**, Infisical checks the credentials. For **Assume Role**, it assumes the role, so the role's trust policy has to name the right AWS account and External ID. For **Access Key**, it signs in with the access key. Infisical doesn't check the permissions from [Step 2](#step-2-add-permissions) until an integration uses them.

<Check>
    Your AWS app connection is ready to use.
</Check>

## Step 4: Configure integrations

Now that your AWS app connection is configured, you can use it to set up the following integrations:

<CardGroup cols={2}>
    <UseCase use="secrets-manager">
        <Card title="AWS Secrets Manager sync" icon="refresh-cw" href="/integrations/secret-syncs/aws-secrets-manager">
            Sync secrets from Infisical to AWS Secrets Manager.
        </Card>
    </UseCase>
    <UseCase use="parameter-store">
        <Card title="AWS Parameter Store sync" icon="refresh-cw" href="/integrations/secret-syncs/aws-parameter-store">
            Sync secrets from Infisical to AWS Parameter Store.
        </Card>
    </UseCase>
    <UseCase use="iam-rotation">
        <Card title="AWS IAM user secret rotation" icon="rotate-cw" href="/documentation/platform/secret-rotation/aws-iam-user-secret">
            Rotate an IAM user's access keys on a schedule.
        </Card>
    </UseCase>
    <UseCase use="acm-sync">
        <Card title="AWS Certificate Manager sync" icon="file-badge" href="/documentation/platform/pki/applications/certificate-syncs/aws-certificate-manager">
            Sync certificates from Infisical to AWS Certificate Manager.
        </Card>
    </UseCase>
    <UseCase use="elb-sync">
        <Card title="AWS Elastic Load Balancer sync" icon="file-badge" href="/documentation/platform/pki/applications/certificate-syncs/aws-elastic-load-balancer">
            Attach certificates from Infisical to load balancer listeners.
        </Card>
    </UseCase>
    <UseCase use="pki-secrets-manager">
        <Card title="AWS Secrets Manager certificate sync" icon="file-badge" href="/documentation/platform/pki/applications/certificate-syncs/aws-secrets-manager">
            Store certificates from Infisical as secrets in AWS Secrets Manager.
        </Card>
    </UseCase>
    <UseCase use="private-ca">
        <Card title="AWS Private CA" icon="landmark" href="/documentation/platform/pki/ca/aws-pca">
            Issue certificates from your AWS Private CA.
        </Card>
    </UseCase>
    <UseCase use="acm-public-ca">
        <Card title="AWS Certificate Manager public CA" icon="landmark" href="/documentation/platform/pki/ca/aws-acm-public-ca">
            Issue publicly trusted certificates through AWS Certificate Manager.
        </Card>
    </UseCase>
    <UseCase use="acme-route53">
        <Card title="ACME CA with Route 53" icon="landmark" href="/documentation/platform/pki/ca/acme-ca">
            Prove domain ownership for an ACME CA through Route 53.
        </Card>
    </UseCase>
    <UseCase use="honey-tokens">
        <Card title="AWS honey tokens" icon="bell-ring" href="/documentation/platform/honey-tokens/aws/setup">
            Detect leaked AWS credentials with decoy access keys.
        </Card>
    </UseCase>
    <UseCase use="pam-recording">
        <Card title="PAM session recording" icon="video" href="/documentation/platform/pam/sessions/external-storage">
            Store PAM session recordings in your S3 bucket.
        </Card>
    </UseCase>
    <UseCase use="agent-vault-session-logs">
        <Card title="Agent Vault session logs" icon="list" href="/documentation/platform/agent-vault/session-logs">
            Record every request an AI agent makes in your S3 bucket.
        </Card>
    </UseCase>
</CardGroup>