> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.withpaygent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.withpaygent.com/_mcp/server.

# AWS Cost Tracking Setup

Connect your AWS account to track infrastructure costs automatically. Follow these steps to configure billing data access.

> **What You'll Need**
>
> AWS account with billing access, ability to create IAM roles, and an S3 bucket.

## Step 1: Setup S3 Billing Backup

Configure AWS to export billing data to an S3 bucket using Legacy CUR export.

1. Go to **Billing and Cost Management** console

2. Navigate to **Data Exports**

3. Click the **Create** button

   ![AWS Create Export Button](/_fern-img/750ecb32bd2d6bda804b0a56492a5822504bb87b3014d72665d9a5882311bbd0.webp)

4. Select **Legacy CUR export** and provide an export name

   > Example export name: `paygent-billing-export`

   ![Select Legacy CUR Export](/_fern-img/7b7c003d789f6f3ddba83d2f6cd46fc70fbfb4476bb7f21284d0d50874291633.webp)

5. Configure export settings:

   * ✓ Include resource IDs
   * ✓ Split cost allocation data
   * Data export: **Daily**

   ![Export Settings Configuration](/_fern-img/96c72894de59ad4bced48b2e01cdeae9e746e57b57c26d80dbc999e63362612a.webp)

6. Configure S3 bucket for export storage

   > **Important**
   >
   > Note the S3 bucket name you create — you'll need it in the next step!

   ![S3 Bucket Configuration](/_fern-files/withpaygent.docs.buildwithfern.com/7744176c9753348bcc792859015113b58f9d9577c39e10c19416666ec4540e7a/assets/aws-setup/aws-setup-s3-four.webp)

7. Give the S3 path prefix — **paygent-cost-tracking-2**

8. Complete the export creation and wait for it to be ready

---

## Step 2: Generate CloudFormation Template

In the Paygent dashboard, navigate to **Infra Cost** and select the AWS tab.

1. Enter your **S3 bucket name** from Step 1

2. Click **Generate YAML File**

   The template will download automatically with your specific bucket configuration

---

## Step 3: Deploy CloudFormation Stack

Upload the template to AWS CloudFormation to create the IAM role.

1. Go to **CloudFormation** console and click **Create Stack** → **With new resources**

   ![Create CloudFormation Stack](/_fern-img/46b64d49e8ea34ac25ad2f3379c2202f2f58cebb0a3f19ed31c977361ee81a1a.webp)

2. Choose **Template is ready** → **Upload a template file**

   Select the YAML file downloaded in Step 2, then give your stack a name

   ![Upload CloudFormation Template](/_fern-img/3150c6d42bdbb59b09b15f9421102e19b4c1794b1d3795568a314ce0731669ee.webp)

3. Follow the wizard to deploy (accept defaults)

   Click through the configuration pages and acknowledge IAM resource creation at the end

4. Wait for stack creation to complete (Status: **CREATE\_COMPLETE**)

   > **Info**
   >
   > ⏱️ This usually takes 2–3 minutes

5. After creation, go to the **Outputs** tab and copy the **RoleARN** value

   > Example: `arn:aws:iam::123456789012:role/PaygentCostTrackingRole`

   ![Copy Role ARN from Outputs](/_fern-img/0ec471d913151bb78fa7b05fbe9f88aacfce4fe89d944f89f29e7e6e3776f07d.webp)

---

## Step 4: Complete Configuration

Return to Paygent and complete the setup with your AWS role details.

1. Paste the **Role ARN** from CloudFormation outputs

2. Verify the **External ID** is auto-filled correctly

3. Confirm the **S3 Bucket Name** and **Region**

4. Click **Complete Setup**

---

> **Setup Complete!**
>
> Cost data will be available within 24–48 hours. Paygent will automatically sync your AWS billing data daily.

---

## Troubleshooting

#### Role verification failed

Ensure the CloudFormation stack completed successfully and the External ID matches exactly. Check that the role has the correct trust policy.

#### S3 access denied

Verify the S3 bucket name is correct and the bucket exists in the specified region. Ensure CUR reports are being generated to this bucket.

#### No cost data appearing

AWS CUR reports are generated daily. Wait 24–48 hours after setup. Ensure your AWS account has actual usage to report.