How to Manage Account IAM Roles
Account IAM Roles allow you to grant your AWS IAM roles access to download report files directly from Lumar's S3 bucket. This is useful for integrating Lumar data into your own data pipelines without needing to use signed URLs.
Overview
When you register an IAM role with your Lumar account:
- The role ARN is validated to ensure it follows the correct AWS IAM role ARN format
- A bucket policy statement is added to Lumar's reports S3 bucket granting the role
s3:GetObjectands3:ListBucketpermissions - Access is scoped to only your account's data (files prefixed with
account_{accountId}/)
Limits
- Maximum of 5 IAM roles per account
- Role ARN must match the pattern:
arn:aws:iam::{12-digit-account-id}:role/{role-name}
Prerequisites
Before registering an IAM role, ensure:
- You have Admin role access to the Lumar account
- Your AWS IAM role exists and is configured with the appropriate trust policy
- Your IAM role ARN is in the correct format
Creating an Account IAM Role
Use the createAccountIamRole mutation to register an IAM role with your account.
- Mutation
- Variables
- Response
- cURL
mutation CreateAccountIamRole($input: CreateAccountIamRoleInput!) {
createAccountIamRole(input: $input) {
entity {
id
roleArn
createdAt
updatedAt
}
}
}
{
"input": {
"accountId": "TjAwN0FjY291bnQ3MTU",
"roleArn": "arn:aws:iam::123456789012:role/LumarReportAccess"
}
}
{
"data": {
"createAccountIamRole": {
"entity": {
"id": "TjAzNUFjY291bnRJYW1Sb2xlMQ",
"roleArn": "arn:aws:iam::123456789012:role/LumarReportAccess",
"createdAt": "2024-12-23T10:00:00.000Z",
"updatedAt": "2024-12-23T10:00:00.000Z"
}
}
}
}
curl -X POST -H "Content-Type: application/json" -H "apollographql-client-name: docs-example-client" -H "apollographql-client-version: 1.0.0" -H "x-auth-token: YOUR_API_SESSION_TOKEN" --data '{"query":"mutation CreateAccountIamRole($input: CreateAccountIamRoleInput!) { createAccountIamRole(input: $input) { entity { id roleArn createdAt updatedAt } } }","variables":{"input":{"accountId":"TjAwN0FjY291bnQ3MTU","roleArn":"arn:aws:iam::123456789012:role/LumarReportAccess"}}}' https://api.lumar.io/graphql
Input Fields
| Field | Type | Required | Description |
|---|---|---|---|
accountId | ObjectID | Yes | The ID of the account to add the IAM role to |
roleArn | String | Yes | The full ARN of the AWS IAM role |
Error Handling
The mutation may return the following errors:
AccountIamRolesLimitReached- Maximum of 5 IAM roles per account has been reachedAccountIamRoleAlreadyExists- The role ARN is already registered to this accountInvalidIamRoleArn- The role ARN format is invalidAccountIamRolePolicyUpdateFailed- Failed to update the S3 bucket policy
Listing Account IAM Roles
Query the iamRoles connection on an Account to list all registered IAM roles.
- Query
- Variables
- Response
- cURL
query GetAccountIamRoles($accountId: ObjectID!) {
getAccount(id: $accountId) {
id
name
iamRoles(first: 10) {
totalCount
nodes {
id
roleArn
createdAt
updatedAt
}
}
}
}
{
"accountId": "TjAwN0FjY291bnQ3MTU"
}
{
"data": {
"getAccount": {
"id": "TjAwN0FjY291bnQ3MTU",
"name": "Your Account Name",
"iamRoles": {
"totalCount": 2,
"nodes": [
{
"id": "TjAzNUFjY291bnRJYW1Sb2xlMQ",
"roleArn": "arn:aws:iam::123456789012:role/LumarReportAccess",
"createdAt": "2024-12-23T10:00:00.000Z",
"updatedAt": "2024-12-23T10:00:00.000Z"
},
{
"id": "TjAzNUFjY291bnRJYW1Sb2xlMg",
"roleArn": "arn:aws:iam::123456789012:role/LumarDataPipeline",
"createdAt": "2024-12-22T14:30:00.000Z",
"updatedAt": "2024-12-22T14:30:00.000Z"
}
]
}
}
}
}
curl -X POST -H "Content-Type: application/json" -H "apollographql-client-name: docs-example-client" -H "apollographql-client-version: 1.0.0" -H "x-auth-token: YOUR_API_SESSION_TOKEN" --data '{"query":"query GetAccountIamRoles($accountId: ObjectID!) { getAccount(id: $accountId) { id name iamRoles(first: 10) { totalCount nodes { id roleArn createdAt updatedAt } } } }","variables":{"accountId":"TjAwN0FjY291bnQ3MTU"}}' https://api.lumar.io/graphql
Deleting an Account IAM Role
Use the deleteAccountIamRole mutation to remove an IAM role from your account. This will revoke the role's access to the S3 bucket.
- Mutation
- Variables
- Response
- cURL
mutation DeleteAccountIamRole($input: DeleteAccountIamRoleInput!) {
deleteAccountIamRole(input: $input) {
entity {
id
roleArn
}
}
}
{
"input": {
"accountIamRoleId": "TjAzNUFjY291bnRJYW1Sb2xlMQ"
}
}
{
"data": {
"deleteAccountIamRole": {
"entity": {
"id": "TjAzNUFjY291bnRJYW1Sb2xlMQ",
"roleArn": "arn:aws:iam::123456789012:role/LumarReportAccess"
}
}
}
}
curl -X POST -H "Content-Type: application/json" -H "apollographql-client-name: docs-example-client" -H "apollographql-client-version: 1.0.0" -H "x-auth-token: YOUR_API_SESSION_TOKEN" --data '{"query":"mutation DeleteAccountIamRole($input: DeleteAccountIamRoleInput!) { deleteAccountIamRole(input: $input) { entity { id roleArn } } }","variables":{"input":{"accountIamRoleId":"TjAzNUFjY291bnRJYW1Sb2xlMQ"}}}' https://api.lumar.io/graphql
Using the IAM Role
Once registered, your IAM role can directly access report download files in Lumar's S3 bucket. The files are located at:
s3://deepcrawl-dc-reports-prod-1/account_{accountId}/{report-files}
Your role will have permissions to:
- List objects with the prefix
account_{accountId}/ - Get objects under
account_{accountId}/
Example: AWS CLI
# List your account's report files
aws s3 ls s3://deepcrawl-dc-reports-prod-1/account_715/ --profile your-assumed-role
# Download a specific report file
aws s3 cp s3://deepcrawl-dc-reports-prod-1/account_715/report.csv ./report.csv --profile your-assumed-role
Example: AWS SDK (Node.js)
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
const s3 = new S3Client({ region: "us-east-1" });
const response = await s3.send(
new GetObjectCommand({
Bucket: "deepcrawl-dc-reports-prod-1",
Key: "account_715/report.csv",
}),
);