---
title: "Connect an AWS account"
description: "Connect an AWS account to Alpacon with guided CloudFormation setup. Follow the steps, review the permissions granted, and verify that the account is connected."
---

> Full documentation index: https://docs.alpacax.com/llms.txt

# Connect an AWS account

Connecting an AWS account lets Alpacon discover your EC2 instances and (optionally) install the agent for you. Setup is guided by a wizard that provisions an IAM role in your account through AWS CloudFormation.

## Before you start

- You need permission to create a CloudFormation stack that provisions IAM roles and a Lambda function (for example, an administrator). On the Quick Create page, select the acknowledgment that CloudFormation may create named IAM resources before you create the stack.
- Have a [server registration token](/use/servers/register/tokens/) ready (or create one during the wizard). The token determines which groups onboarded servers are assigned to and is required for agent installation.

## Connection steps

On the **Cloud accounts** page, click **Connect AWS**. The wizard shows its four steps as chips above the step you are on: **Name account**, **Generate Quick Create URL**, **Verify connection**, and **Discover instances**. A finished step's chip shows what you chose, such as the account name or the stack name, and is locked: the account already exists in Alpacon, so the step can't be reopened. To change a finished step, use **Delete and start over** and run the wizard again.

1. **Name account**—Enter a display name for the account. Under permissions, **Read EC2 inventory** is always included; select **Install agent via AWS SSM** to allow agent installation through AWS SSM. Pick the **Server registration token** new agents register with, then click **Continue**. A second page asks **Who maintains this account?**: pick at least one member, optionally add a reason, and click **Continue** again to create the account. You are not picked automatically. If you leave yourself out and you are not a Superuser or Staff member, the page warns that you will lose access to the account once it is created, including the rest of the setup.
2. **Generate the Quick Create URL**—Click **Open AWS Console** to open AWS CloudFormation with the stack pre-filled. Each account gets its own stack name: `AlpaconConnect-` followed by the first 8 characters of the account's ID in Alpacon, the ID at the end of the account page's address. Connecting a second account from the same AWS account and region therefore does not collide with the first. The control-plane region is `us-east-1`. Create the stack in AWS. If someone else holds AWS access, open **Or use the direct URL** and send them the URL. **How does this work?** explains what the stack creates. **Cancel** on this step deletes the pending account from Alpacon.
3. **Verify the connection**—Keep the Alpacon tab open. Alpacon waits for the CloudFormation stack to finish and confirms it can assume the IAM role. The steps shown are: submit stack → create stack → assume IAM role → connection verified. If verification fails, the failed step shows why, with **Show error message** when AWS returned an error, and you can click **Retry verification**. **Reopen AWS Console** opens the stack again, and **Delete and start over** deletes the pending account. A stack already created in AWS stays there, so delete it before you connect again.
4. **Discover instances**—Alpacon starts syncing your EC2 inventory and shows the instances found per region in real time. A scan can also finish without every region, stop on an error, or never report back; the panel says which happened and offers **Scan again**. When it is done, **Go to account** opens the account's page and **Instance list** opens the [cloud instance list](/use/servers/cloud-instances/).

## Permissions Alpacon receives

The CloudFormation stack grants Alpacon a role named `AlpaconCrossAccountRole-` followed by the stack's ID—the UUID at the end of the stack ID shown in CloudFormation—so each connection gets its own role. An account connected with an earlier template version has a role named `AlpaconCrossAccountRole`, with no suffix. The role grants:

- **Read EC2 inventory** (required)—list instances, regions, and tags across all regions.
- **Install agent via AWS SSM** (optional)—send install commands so you can onboard instances with one click. This permission is controlled by the stack's `EnableRemoteCommand` parameter, which is fixed when the stack is created. Allowing agent installation in the wizard sets that parameter in the Quick Create link, but turning **Remote agent installation** on in Alpacon later does not add the permission to an existing stack.

To change the choice after connecting, update the account's CloudFormation stack in AWS with `EnableRemoteCommand` set to the value you want, then recheck the permission in Alpacon. See [Remote command permission](/integrate/cloud/accounts/#remote-command-permission).

You can revoke access at any time by deleting the CloudFormation stack in your AWS account.

## Troubleshooting

**Verification failed**—Confirm the CloudFormation stack finished creating and that the IAM role trust policy is intact. Use **Retry verification**, or delete the stack and run the wizard again. Check AWS CloudTrail for permission errors.

**Agent installation is blocked**—an install refused with the API error code `cloud_remote_command_permission_missing` has one of two causes, and the account's **AWS stack permission** state tells them apart. When it reads **Denied**, the IAM role lacks the SSM permission, typically because the stack was created with `EnableRemoteCommand` off: update the stack with `EnableRemoteCommand` set to `true`, then use **Recheck** on the account page if you are allowed to recheck. Otherwise a policy outside the role refused it: check the service control policies, permission boundaries, and explicit denies that apply to the instance and its region. See [Remote command permission](/integrate/cloud/accounts/#remote-command-permission).

**Discovery failed**—The scan stopped before it could finish, so anything it had not reached yet is missing. The panel shows the reason AWS returned; a permission missing from the IAM role is the usual cause. Fix the role and use **Scan again**. If discovery cannot be made to work at all, you can still register a server by hand with a [server registration token](/use/servers/register/tokens/).

**Some regions were skipped**—The scan finished, but could not read every region, so instances in the skipped ones are missing from the list. The panel names each region it skipped and why; a region marked **Access denied** was denied outright—commonly a region the account has not enabled, an organization policy (such as an SCP) that denies the role in that region, or a permission missing from the IAM role for that region specifically. A region skipped for another reason is usually temporary and clears on its own. Skipping regions does not fail the account by itself; see **The account is marked failed** below for what does. Enable or grant the region, then use **Scan again**.

**Access denied in every region**—The scan reached every region, but each one denied the role. The panel shows **Access denied in every region**: **Nothing could be scanned this time. If this keeps happening, the account will be marked failed.** One denied scan does not fail the account by itself—that takes three in a row (see **The account is marked failed** below). Fix the role or the region's organization policy, then use **Scan again**.

**No response from the scan**—The account is connected, but the scan never reported back, so nothing is known about its instances yet. This is not the same as an account that holds none. Use **Scan again**.

**The account is marked failed**—AWS denied the role outright: at verification (the first check after connecting, or a later use of **Retry verification**), or across three discovery scans in a row where AssumeRole was refused, every region was denied, or listing regions was refused. A scan that still finds instances resets the refusal count. **Scan again** is refused in this state; open the account and use **Retry verification** in its failure banner to bring it back, which also clears the failure count and starts a new scan on its own. Fix what the panel reported first, or the scan that follows fails the same way. A temporary problem—AWS throttling, an AWS outage, a timeout, or an expired credential on Alpacon's side—does not fail the account on its own: Alpacon records the error and keeps scanning. The one exception is the first verification after connecting, which retries automatically a few times before marking the account failed if the problem does not clear up.

## Related docs

- [Manage accounts](/integrate/cloud/accounts/)
- [Cloud instances](/use/servers/cloud-instances/)
- [Install the agent](/integrate/cloud/install-agent/)
- [Server registration token](/use/servers/register/tokens/)

Source: https://docs.alpacax.com/integrate/cloud/connect-aws/
