Provider Connectors
Single account
Connect one AWS account to LevelFour in a click from the dashboard, with a CloudFormation Launch Stack link, or with Terraform. Covers the two IAM roles the stack creates and how to revoke them.
LevelFour reads your AWS costs through IAM roles it creates in your account. You can connect one account from the dashboard in a click, with a CloudFormation Launch Stack link where you enter the handshake ID LevelFour gave you, or with Terraform.
If your accounts sit under AWS Organizations, the multi-account path onboards every one of them in a single deployment.
Self-service path (recommended)
The whole flow runs from the LevelFour dashboard without an onboarding contact in the loop. Go to Connect Providers > AWS in the dashboard (https://dashboard.levelfour.ai/connect-accounts/aws) and click Connect via AWS Console. The dashboard opens AWS Console with the v2 CloudFormation template pre-loaded. Click Create stack, and the deployed stack pings LevelFour automatically.
Prerequisites
- An AWS account with permission to create IAM roles and CloudFormation stacks (typically an admin role)
- The LevelFour Handshake ID provided by your LevelFour contact
Deploy with a Launch Stack link
Use the steps below when you cannot reach the dashboard, for example when the person who holds AWS access is not the LevelFour admin.
Open the Launch Stack link
Sign in to the AWS account you want to onboard, then click the Launch Stack link below. It opens the CloudFormation console with the LevelFour onboarding template pre-loaded.
https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/quickcreate?templateURL=https://cf-templates-1bsphth8u70q9-us-east-1.s3.amazonaws.com/onboarding/v2/onboarding-levelfour-cloudformation-template.json&stackName=LevelFourRegion does not matter for IAM resources. Leave it on us-east-1.
Enter the handshake ID
CloudFormation shows the template's parameters:
- LevelFourHandshakeID: paste the value LevelFour gave you. Treat it like a secret, and do not share or change it.
- IntegrationID and PingbackTopicArn: leave both blank. Only the dashboard self-service flow uses them, to auto-confirm the connection.
Leave the stack name as LevelFour, or change it if your team uses a naming convention.
CREATE_COMPLETE and the connection never works. Paste the value, do not retype it.Acknowledge the IAM capability
At the bottom of the page, tick:
I acknowledge that AWS CloudFormation might create IAM resources with custom names.
AWS asks for this because the template creates roles with specific names (LevelFourCrossAccountRole, plus an empty LevelFourSavingsExec role for Automated Savings) rather than letting AWS auto-generate them. Predictable names let LevelFour find the roles without you copying ARNs back to LevelFour.
Click Create stack.
Wait for CREATE_COMPLETE
CloudFormation provisions the role. It typically takes 30 to 60 seconds. Watch the Events tab for progress.
CREATE_COMPLETE, the role exists in your account. Whether LevelFour can use it is confirmed in the next step, not here.Confirm the role and notify LevelFour
Open the stack's Outputs tab:
- RoleArn:
arn:aws:iam::<your-account-id>:role/LevelFourCrossAccountRole - SavingsExecRoleArn:
arn:aws:iam::<your-account-id>:role/LevelFourSavingsExec(the Automated Savings execution role) - HandshakeID: the same value you entered, echoed back for verification
Reply to your LevelFour contact with the AWS account ID. LevelFour validates that the role works (it attempts an sts:AssumeRole using your handshake ID) and starts ingesting data for that account.
Deploy with Terraform
Use this path when you manage the account as code. Terraform deploys the same LevelFour template through an aws_cloudformation_stack resource. The roles and their permissions match the Launch Stack link, and the stack lives in your Terraform state.
Add the stack to your configuration
Point the AWS provider at the account you want to onboard. allowed_account_ids stops Terraform before it changes anything in a different account. If your configuration already has a provider for this account, keep yours and leave this one out.
provider "aws" {
region = "us-east-1"
allowed_account_ids = ["<your-account-id>"]
}
variable "levelfour_handshake_id" {
description = "The handshake ID LevelFour gave you"
type = string
sensitive = true
}
resource "aws_cloudformation_stack" "levelfour" {
name = "LevelFour"
template_url = "https://cf-templates-1bsphth8u70q9-us-east-1.s3.amazonaws.com/onboarding/v2/onboarding-levelfour-cloudformation-template.json"
capabilities = ["CAPABILITY_NAMED_IAM"]
parameters = {
LevelFourHandshakeID = var.levelfour_handshake_id
}
}
output "levelfour_role_arn" {
value = aws_cloudformation_stack.levelfour.outputs["RoleArn"]
}
output "levelfour_savings_exec_role_arn" {
value = aws_cloudformation_stack.levelfour.outputs["SavingsExecRoleArn"]
}CAPABILITY_NAMED_IAM is the acknowledgement the console asks for, because the template creates LevelFourCrossAccountRole and LevelFourSavingsExec by name. Leave IntegrationID and PingbackTopicArn out. Only the dashboard flow uses them.
Apply with your handshake ID
Pass the handshake ID through an environment variable, so it stays out of your .tf and .tfvars files:
export TF_VAR_levelfour_handshake_id='<your-handshake-id>'
terraform init
terraform applyterraform apply returns once the stack reaches CREATE_COMPLETE, typically 30 to 60 seconds later. If CloudFormation rolls the stack back, the apply fails and prints the stack's error.
Check the outputs and notify LevelFour
Run terraform output to see both role ARNs:
- levelfour_role_arn:
arn:aws:iam::<your-account-id>:role/LevelFourCrossAccountRole - levelfour_savings_exec_role_arn:
arn:aws:iam::<your-account-id>:role/LevelFourSavingsExec(the Automated Savings execution role)
Reply to your LevelFour contact with the AWS account ID. LevelFour validates that the role works (it attempts an sts:AssumeRole using your handshake ID) and starts ingesting data for that account.
Onboarding more accounts
Repeat the deploy in each additional AWS account, using the same handshake ID. Each account gets its own role with the same predictable name. With Terraform, that is one aws_cloudformation_stack per account, each under a provider for that account.
Past three or four accounts, switch to the multi-account path.
What the stack creates
The stack creates two roles. Both trust LevelFour's AWS account (730335248431) and only accept AssumeRole requests that include your specific LevelFourHandshakeID as the external ID.
LevelFourCrossAccountRole is the read-only role LevelFour uses to analyze your costs. Its permissions:
- AWS managed
ReadOnlyAccess(read-only access to all resources) - A focused inline policy covering: Cost Explorer, Compute Optimizer, Cost Optimization Hub, Savings Plans, Pricing, AWS Support, Trusted Advisor, S3 Storage Lens, BCM Data Exports, Container Insights, and the IAM service-linked role creation needed to enroll in those services
LevelFourSavingsExec is created empty, with no attached permissions. It exists so that, when you approve a specific Automated Savings action, a scoped policy covering only that action and its resources is attached for a short, time-limited window and then expires on its own. Nothing in your account can be changed until you explicitly approve such an action.
You can review the full template before deploying:
https://cf-templates-1bsphth8u70q9-us-east-1.s3.amazonaws.com/onboarding/v2/onboarding-levelfour-cloudformation-template.jsonRemoving access
To revoke LevelFour's access to an account, delete the CloudFormation stack:
aws cloudformation delete-stack --stack-name LevelFourThis removes both roles (LevelFourCrossAccountRole and LevelFourSavingsExec). LevelFour stops being able to read data from that account immediately.
If you deployed with Terraform, remove the aws_cloudformation_stack.levelfour resource and its two outputs from your configuration, then run terraform apply. Do not delete the stack with the AWS CLI instead: the resource is still in your configuration, so the next terraform apply creates the stack again.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
CREATE_FAILED, "Role with name LevelFourCrossAccountRole already exists" | The LevelFour role is already deployed in this account | Skip it, the account is already onboarded. To redeploy, delete the existing role first |
CREATE_FAILED with an SCP-related error | Service Control Policies in your AWS Organization block IAM role creation in this account | Ask your AWS administrator to permit iam:CreateRole, iam:AttachRolePolicy and iam:PutRolePolicy for the role name LevelFourCrossAccountRole |
terraform apply fails with Requires capabilities : [CAPABILITY_NAMED_IAM] | The aws_cloudformation_stack resource has no capabilities argument | Add capabilities = ["CAPABILITY_NAMED_IAM"] and apply again |
| The stack succeeded but LevelFour says the role is not accessible | The handshake ID you entered does not match what LevelFour provided | Update the stack and re-enter the correct value. With Terraform, export the correct TF_VAR_levelfour_handshake_id and apply again |
Next
- Detailed cost data turns on the Cost and Usage Report, which is what gives you resource-level and tag-level breakdowns
- Automated Savings covers the
LevelFourSavingsExecrole, including accounts onboarded before it existed
Connect AWS
Pick the AWS path that matches your account layout, then add detailed cost data and Automated Savings when you want them.
Multi-account
Onboard every AWS account in your organization at once, from the dashboard or by deploying one CloudFormation StackSet in the management account, by hand or with Terraform.