> ## Documentation Index
> Fetch the complete documentation index at: https://docs.plerion.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started with an AWS service account

> Set up a dedicated AWS service account to simplify CWPP deployment, so you can centrally manage appliances, protect workloads across multiple accounts, and gain complete visibility with less effort.

Setting up an AWS service account involves two main steps:

1. Setting up the permissions required to run Plerion infrastructure
2. Installing the infrastructure in the regions where you want to run workload scans

***

## Step 1: Set up permissions

**1. On the Plerion dashboard, go to Settings > Integrations**

![Sidebar navigation with Settings expanded and Integrations highlighted](https://mintcdn.com/pleriondocs/xqwXbDdIvpJS066S/images/integrations/aws/settings-integrations-sidenav.png?fit=max\&auto=format\&n=xqwXbDdIvpJS066S\&q=85\&s=76e3ee2c20634eb080fc39574d8b029f)

**2. Find AWS workload service account and click the + button**

![Integrations page with AWS service account account option and plus button to add integration](https://mintcdn.com/pleriondocs/xqwXbDdIvpJS066S/images/integrations/aws/add-aws-service-account.png?fit=max\&auto=format\&n=xqwXbDdIvpJS066S\&q=85\&s=9a497727dcbbaf08679f3ec93486c146)

**3. Launch the CloudFormation stack**

Click `Launch stack` to open the **Quick create stack** page in AWS CloudFormation.

![Launch CloudFormation stack for AWS service account](https://mintcdn.com/pleriondocs/xqwXbDdIvpJS066S/images/integrations/aws/launch-cloudformation-stack-for-aws-service-account.png?fit=max\&auto=format\&n=xqwXbDdIvpJS066S\&q=85\&s=cd19accfcdba82f440af9791551b87f4)

**4. Confirm the service account is added**

* After the CloudFormation stack completes, the service account will be created automatically.
* You will see it listed on the **Service Accounts** page in Plerion.
* If the account belongs to an AWS organization that is new to your tenant, Plerion holds it for approval instead of enabling it. See [Service account approval](#service-account-approval).

![Service account list in Plerion](https://mintcdn.com/pleriondocs/2HBIdIEF_iUoBKh-/images/service-account/setup/service-account-list.png?fit=max\&auto=format\&n=2HBIdIEF_iUoBKh-\&q=85\&s=f7a77464203faceb3a76b38e69801091)

**5. Open the service account details**

![Service account details page in Plerion](https://mintcdn.com/pleriondocs/2HBIdIEF_iUoBKh-/images/service-account/setup/service-account-view.png?fit=max\&auto=format\&n=2HBIdIEF_iUoBKh-\&q=85\&s=2e77d956a4b6fa0d279bf5ff071fc4d0)

**6. Configure regions for deployment**

* From the service account details page, configure the regions where you want to install the Plerion infrastructure.
* See [Step 2: Install infrastructure in regions](https://docs.plerion.com/guides/integrations/aws/service-account/getting-started-with-aws-service-account.md#step-2%3A-install-infrastructure-in-regions).

### Limitations

* An AWS account can only be associated with **one service account**.
* Service accounts cannot be shared across tenants or organizations.
* A maximum of **5 service accounts** can be created in a tenant. A service account that is awaiting approval counts toward this limit.

### Resources created

Creating the CloudFormation stack will deploy:

| Resource | Resource type | Description |
| - | - | - |
| PlerionWorkloadAccessRole | AWS::IAM::Role | Role assumed by the Plerion Control Plane to manage the service account. |
| PlerionWorkloadAccessPolicy | AWS::IAM::ManagedPolicy | Policy attached to the role above, granting permissions to manage appliances and clean up resources. |
| PlerionInstanceProfileRole | AWS::IAM::Role | Role attached to appliance instances, allowing them to assume target account roles. |
| PlerionInstanceProfile | AWS::IAM::InstanceProfile | Instance profile using the appliance role. |
| PlerionRegistration | Custom::PlerionServiceAccount | Registers the service account with Plerion. It reports the role and instance profile to Plerion's registration topic, and Plerion verifies them by assuming the role before creating the service account. |

### Troubleshooting

**Error:** `PlerionInstanceProfileRole already exists in the stack`\
**Cause:** This indicates the AWS account is already being used as a service account in another Plerion organization.\
**Fix:** Remove the existing service account and stack, or use a different AWS account.

**Error:** `AWS account <account id> is already registered with Plerion by stack <stack id>. Update that stack, or delete it before launching another.`\
**Cause:** Only the stack that registered a service account can change it. A second permission stack in the same account is refused.\
**Fix:** Update the existing stack instead, or delete it and then launch the new one.

***

## Service account approval

Plerion holds a new service account for approval when it belongs to an AWS organization that no account in your tenant belongs to. The same rule applies to [AWS accounts](https://docs.plerion.com/guides/integrations/aws/aws-account/getting-started-with-aws-account.md#account-approval). This confirms that the service account was added deliberately, because the stack can be launched by someone who is not a Plerion user.

A service account is enabled as normal when:

* It is the first account in your tenant.
* It belongs to the same AWS organization as an AWS account or service account you have already added.

A service account is held for approval when:

* It belongs to a different AWS organization.
* It belongs to no AWS organization, and your tenant already contains accounts that do.
* Plerion cannot determine which AWS organization it belongs to.

### While a service account is awaiting approval

The service account is listed under `Settings` > `Integrations` with a **Pending approval** label. Open it to see the account and, where Plerion could determine it, the AWS organization it belongs to.

While a service account is held:

* It is disabled and cannot be enabled.
* `Enable region` is disabled, and a region stack launched for the account fails with `awaiting approval`.
* `Add account` is disabled, and the account cannot be selected when linking a target account. No AWS account is scanned through it.

> [!NOTE]
>
> Plerion does not send a notification when a service account is held, and a held service account does not expire.

### Approve a service account

Any user with permission to modify service accounts can approve one, not only the user who launched the stack.

**1. Go to Settings > Integrations and open the service account**

Service accounts waiting on a decision carry a **Pending approval** label.

**2. Click Approve this service account**

The service account becomes enabled. Continue with [Step 2: Install infrastructure in regions](#step-2%3A-install-infrastructure-in-regions).

If you do not recognize the service account, delete it instead of approving it.

***

## Step 2: Install infrastructure in regions

**1. On the service account dashboard, click Enable region**

![Enable region button in service account dashboard](https://mintcdn.com/pleriondocs/2HBIdIEF_iUoBKh-/images/service-account/setup/service-account-enable-region.png?fit=max\&auto=format\&n=2HBIdIEF_iUoBKh-\&q=85\&s=0dc36ad3411a63393cecf7a6f3ad98c4)

**2. Launch the CloudFormation stack**

Select the region where you want to install the Plerion infrastructure and click `Launch Stack`.

![Select region and launch stack](https://mintcdn.com/pleriondocs/2HBIdIEF_iUoBKh-/images/service-account/setup/enable-region.png?fit=max\&auto=format\&n=2HBIdIEF_iUoBKh-\&q=85\&s=30374b28a07b4599d56144f39f9ff729)

**3. Complete the AWS CloudFormation wizard**

Follow the on-screen steps in AWS CloudFormation to deploy the infrastructure.

**4. Confirm the region is enabled**

* After the stack finishes, the region will appear as enabled in the service account dashboard.
* Enable and install infrastructure in all regions where you want to run workload scans.

![Service account dashboard showing enabled region](https://mintcdn.com/pleriondocs/2HBIdIEF_iUoBKh-/images/service-account/setup/region-enabled.png?fit=max\&auto=format\&n=2HBIdIEF_iUoBKh-\&q=85\&s=108e3c26b2c739d659dfac5c4959403d)

**5. Link target accounts to the service account**

* After installing infrastructure in all required regions, link target accounts.
* See [Linking target accounts to a service account](https://docs.plerion.com/guides/integrations/aws/service-account/linking-target-accounts-to-service-account.md).

### Appliance network

The `ApplianceNetwork` parameter decides where appliances run:

* `PublicSubnet`: appliances run in the public subnet with a public IP while they scan. Their security group allows no inbound traffic. No NAT gateway is created. This is what the **Launch Stack** button in Plerion uses for a new region.
* `PrivateSubnetWithNatGateway`: appliances run in a private subnet and reach the internet through a NAT gateway with a fixed IP. Choose this if your network rules need a fixed outbound IP or forbid public IPs. AWS bills a NAT gateway for every hour it runs, scan or no scan, and for every GB that passes through it.

`PrivateSubnetWithNatGateway` is the template's default, so updating a stack created before template version v1.5.0 keeps its NAT gateway. To move an existing stack to `PublicSubnet`, update the stack and set the parameter.

### Resources created

Installing the CloudFormation template will create the following resources in each region:

| Resource | Resource type | Description |
| - | - | - |
| ASGServiceLinkedRole | AWS::IAM::ServiceLinkedRole | The service-linked role that Auto Scaling uses to manage the appliance instances. |
| ElasticIpAZ1 | AWS::EC2::EIP | The Elastic IP address for the NAT gateway. Created only when `ApplianceNetwork` is `PrivateSubnetWithNatGateway`. |
| InternetGateway | AWS::EC2::InternetGateway | Allow the VPC to access the internet. |
| NatGatewayAZ1 | AWS::EC2::NatGateway | The NAT gateway that gives the private subnet internet access. Created only when `ApplianceNetwork` is `PrivateSubnetWithNatGateway`. |
| PlerionApplianceAmiParameter | AWS::SSM::Parameter | The `/plerion/workload/appliance-ami` parameter that holds the appliance image ID. Plerion writes the current image ID to it before each scan. |
| PlerionApplianceAutoScalingGroup | AWS::AutoScaling::AutoScalingGroup | The AutoScaling group that will be used to manage the appliance instances. |
| PlerionApplianceLaunchLifecycleHook | AWS::AutoScaling::LifecycleHook | The lifecycle hook that will be used to manage the appliance instances. |
| PlerionApplianceLaunchTemplate | AWS::EC2::LaunchTemplate | The launch template that will be used to launch the appliance instances. |
| PlerionApplianceQueueBacklogNoInstances | AWS::CloudWatch::Alarm | The alarm that will be used to scale out the appliance instances. |
| PlerionApplianceQueueBacklogPerInstanceScaleIn | AWS::CloudWatch::Alarm | The alarm that will be used to terminate appliances when the queue has a smaller backlog |
| PlerionApplianceQueueBacklogPerInstanceScaleOut | AWS::CloudWatch::Alarm | The alarm that will be used to scale out the appliance instances when the workload scan queue has a backlog. |
| PlerionApplianceQueueNoBacklogWithInstancesScaleIn | AWS::CloudWatch::Alarm | The alarm that will be used to terminate appliances when the queue has no backlog. |
| PlerionApplianceScanQueue | AWS::SQS::Queue | The queue that will be used to manage the workload scan queue. |
| PlerionApplianceScanQueueDLQ | AWS::SQS::Queue | The dead-letter queue for workload scan jobs that an appliance could not complete. |
| PlerionApplianceSecurityGroup | AWS::EC2::SecurityGroup | The security group that will be used to manage the appliance instances. The security group allows outbound access to allow the appliance to scan and send results |
| PlerionApplianceSubnetAZ1Private | AWS::EC2::Subnet | The private subnet. Appliances run here when `ApplianceNetwork` is `PrivateSubnetWithNatGateway`. |
| PlerionApplianceTerminationLifecycleHook | AWS::AutoScaling::LifecycleHook | The lifecycle hook that will be used to manage the appliance instances. |
| PlerionApplianceVPC | AWS::EC2::VPC | The VPC that will be used to launch the appliance instances. |
| PlerionEbsVPCEndpoint | AWS::EC2::VPCEndpoint | An interface endpoint for EBS in the appliance VPC. Created only when the `CreateVPCEndpoint` parameter is `true`. |
| PlerionEbsVPCEndpointSecurityGroup | AWS::EC2::SecurityGroup | The security group for the EBS endpoint. Created only when the `CreateVPCEndpoint` parameter is `true`. |
| PlerionKmsKey | AWS::KMS::Key | The KMS key that will be used to encrypt the resources being copied from the target accounts. |
| PlerionKmsKeyArnParameter | AWS::SSM::Parameter | The `/plerion/workload/snapshot-encryption-key` parameter that holds the KMS key ARN. |
| PlerionRegistration | Custom::PlerionServiceAccountRegion | Registers the region with Plerion. It reports the VPC, subnet, security group and scan queue to Plerion's registration topic, and Plerion verifies that they belong to this stack before enabling the region. |
| PlerionS3GatewayEndpoint | AWS::EC2::VPCEndpoint | A gateway endpoint for Amazon S3 in the appliance VPC. Container image layers and Lambda code download through it, so they do not pass through a NAT gateway. |
| PlerionScaleInPolicy | AWS::AutoScaling::ScalingPolicy | The policy that will be used to terminate appliances when the queue has no backlog. |
| PlerionScaleOutPolicy | AWS::AutoScaling::ScalingPolicy | The policy that will be used to scale out the appliance instances when the workload scan queue has a backlog. |
| PlerionSubnetAZ1Public | AWS::EC2::Subnet | The public subnet. Appliances run here when `ApplianceNetwork` is `PublicSubnet`; otherwise it holds the NAT gateway. |
| RouteTableAssociationAZ1Private | AWS::EC2::SubnetRouteTableAssociation | The association between the private subnet and the private route table. |
| RouteTableAZ1PrivateCommon | AWS::EC2::RouteTable | The route table for the private subnet. |
| RouteTableAZ1Public | AWS::EC2::RouteTable | The public route table that will be used to route traffic to the internet. |
| RouteTableAZ1PublicSubnetAssociation | AWS::EC2::SubnetRouteTableAssociation | The association between the public subnet and the public route table. |
| RouteTablePrivateCommonAZ1InternetRoute | AWS::EC2::Route | The route from the private subnet to the internet through the NAT gateway. Created only when `ApplianceNetwork` is `PrivateSubnetWithNatGateway`. |
| RouteTablePublicAZ1InternetRoute | AWS::EC2::Route | The route that will be used to route traffic to the internet. |
| ServiceAccountOrganization | Custom::RetrieveOrganizationIdFunction | Custom resource to retrieve the organization ID from the current AWS account. |
| ServiceAccountOrganizationFunction | AWS::Lambda::Function | The Lambda function will be used to retrieve the organization ID from the current AWS account. |
| ServiceAccountOrganizationFunctionExecutionRole | AWS::IAM::Role | The role that will be attached to the ServiceAccountOrganizationFunction to allow the function to retrieve the organization ID from the current AWS account. |
| VPCGatewayAttachment | AWS::EC2::VPCGatewayAttachment | The attachment between the VPC and the Internet Gateway. |

### Troubleshooting

**Error:** `AWS::SQS::Queue` with identifier `plerion-appliance-scan-queue` already exists\
**Cause**: This occurs if Plerion infrastructure is already installed in that region.\
**Fix:**

* Delete the existing infrastructure and retry; or
* Choose a different region

If the duplicate was accidental, delete the failed stack.

**Error:** `The Plerion service account for AWS account <account id> is awaiting approval. Approve it in the Plerion console, then relaunch this stack.`\
**Cause:** The service account has not been approved yet. See [Service account approval](#service-account-approval).\
**Fix:** Approve the service account in Plerion, delete the failed stack, then launch the region stack again.

***

## Next step

* [Linking target accounts to a service account](https://docs.plerion.com/guides/integrations/aws/service-account/linking-target-accounts-to-service-account.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.