AWS CloudTrail Manual Setup - New Trail
This manual setup guide is for those who do not have an existing trail available for use in their CloudTrail service.
This guide takes you through all required manual configurations when creating a new trail in AWS, to allow Expel to access your S3 bucket securely via an API. It also shows you how to add CloudTrail as a security device in Workbench, which completes the integration and enables you to monitor all activity.
Scope and Limitations
When choosing to set up this integration, remember the following:
The AWS setup described here is Expel’s recommended best practice.
There are a number of ways to customize your AWS configurations based on your own environment or protocols. These steps are intended to show the necessary settings that must be configured in order for your Expel integration to work, with basic instructions for how to do so; they do not cover most of the optional settings or explain every possible option in AWS.
Prerequisites
Verify you have the necessary permissions to create and modify IAM policies and roles for your AWS account.
Make sure you are in the management console and that you have your AWS Account ID if you are using AWS Organizations, or are in the proper AWS account if you manage more than one account.
If your organization centralizes CloudTrail logs from multiple subsidiaries into a single S3 bucket, make sure you know the AWS Organizational Unit (OU) ID for the subsidiary.
This is an optional prerequisite that enables us to filter logs so that only the relevant data is sent to each subsidiary's Workbench instance, preventing data overlap.
Check the AWS region in the top menu bar (i.e. us-east-2, us-west-1, etc.) and make sure you are in the home region you want to be in; you must use the same home region throughout the entire AWS configuration process, and you must later specify this region correctly in Workbench.
Make sure you can log into Workbench successfully, and are able to see your organization settings.
This is a good time to copy and save your Workbench GUID, which is a unique alphanumeric value assigned by Expel to your organization and found in the My Organization page; see the Reference for detailed instructions.
Step 1: Download the CloudFormation Templates
CloudFormationTemplate_Accounts.json
For those with a single AWS account and/or those who need to update the management account
Used when deploying a stack
Creates Expel's IAM role (ExpelAssumeRole) in your management account
Creates the required IAM policy (ExpelAccessPolicy); you will define the SQS queue, S3 bucket, and AWS KMS key ARN
CloudFormationTemplate_Orgs.json
For those using AWS Organizations
Used when deploying a stackset
Creates Expel's IAM role (ExpelAssumeRole) in your children accounts; you will create this role in your management account separately
Creates the required IAM policy (ExpelAccessPolicy) for your children accounts; you will grant additional access separately
Step 2: Make Note of Your Needed Values
During the AWS configuration process, you will need to copy out and save a number of values as they are added by you (e.g. the AWS KMS Alias) or generated by AWS (e.g. the SQS Queue ARN). Knowing each of these values is necessary to successfully complete all AWS configuration steps and to also add AWS as a security device in Workbench.
These values include, in the order they are created or generated:
Workbench GUID (if you do not have it yet, get it now)
AWS Account ID (AWS organizations only; get it now)
AWS OU ID (only if you use a single S3 bucket for multiple subsidiaries; get it now)
AWS Region
S3 Bucket Name
AWS KMS Alias
S3 Bucket ARN
SNS Topic ARN
AWS KMS Key ARN
SQS Queue ARN
SQS URL
IAM Role ARN
AWS OU Role ARN (only if you use a single S3 bucket for multiple subsidiaries and you choose to create a separate IAM Role with the additional permissions)
Step 3: Create a New Trail
In this step, you will create a new trail, new S3 bucket, and new AWS KMS key within your chosen home region.
Use the Search bar to quickly navigate to Cloudtrail, or find it in the Services menu.
Select Create trail.
Enter a trail name, such as "ExpelCloudTrail".
AWS Organizations only - select the “Enable for all accounts in my organization” checkbox.
In Storage location, leave Create new s3 bucket selected.
Use the default for the Trail log bucket and folder, or enter a new unique name. Remember that if you choose to create your own name, it must be unique to ALL of AWS — not just to your instance — or the trail creation will fail. You can append your desired name with the alphanumeric values from the default name to ensure uniqueness.
Make a note of your S3 bucket name, as you will need it in a later step.
Leave Log file SSE-KMS encryption as Enabled.
Leave the New radio button selected.
Enter a name for AWS KMS alias.
Make a note of your AWS KMS alias, as you will need it in a later step.
In Additional settings:
Leave Log file validation as Enabled.
Leave SNS notification delivery unchecked.
Leave the CloudWatch Logs and Tags section as is, unless you need to change them for your own protocols, and do not edit the Policy document.
Select Next.
Leave the Choose Log Events screen as is.
Select Next.
You can now review your trail’s settings before creating it, if you wish.
Select Create trail.
You will be taken to the Trails list and should see your new trail.
Step 4: Edit the S3 Bucket Encryption Settings
In this step, you will set your default S3 bucket encryption to server-side encryption with AWS Key Management Service keys (SSE-KMS), and instruct Amazon to use your AWS KMS key’s encryption policy for your log files instead of using SSE-S3 encryption (Amazon’s default).
Use the Search bar to quickly navigate to S3, or find it in the Services menu.
Look for your new S3 bucket in the list and select it.
Select the Properties tab.
First, copy the ARN and save it to a safe place as your S3 Bucket ARN (you will need it for the next section). The format should look something like this: arn:aws:s3:::YourS3BucketName
Next, scroll to Default encryption and select Edit.
Select Server-side encryption with AWS Key Management Service keys (SSE-KMS).
Under AWS KMS key, select Choose from your AWS KMS keys.
Select the AWS KMS key you created earlier (the alias will display in small print below the key).
Leave the Bucket Key as Enable.
Select Save changes.
Step 5: Create a New SNS Topic
Now, you will create an SNS topic and edit its access policy to give the S3 bucket permission to push events to the topic. These communications will eventually be sent from the SNS topic to an SQS queue (configured in a later section).
Use the Search bar to quickly navigate to Simple Notification Service (SNS), or find it in the Services menu.
Select Topics.
Select Create topic.
In the Details section:
Select Standard as the Type.
Enter a topic name in the Name field.
Expand the Encryption section:
Toggle Encryption to on.
Use the dropdown menu to select your AWS KMS Key (or search for the alias if you do not see it).
Expand the Access Policy section:
Leave the method as Basic.
Look at the JSON preview and scroll down to the
Resourcekey.Copy the
Resourcevalue and save it to a safe place as your SNS Topic ARN (you will need it to configure the new access policy). The format should look something like this:arn:aws:sns:us-east-1:123456789012:YourTopicNameNow, select the Advanced button to define a new access policy.
Highlight and delete the existing policy and paste the below policy instead.
Make sure to use your SNS Topic ARN as the Resource value and your S3 Bucket ARN as the aws:SourceARN value.
Important: Did you use your SNS Topic ARN and S3 bucket ARN in the new code? Check to be sure before continuing.
Leave the remaining sections as is and select Create topic.
Step 6: Edit the AWS KMS Key Policy
In an earlier step, you configured your S3 bucket to use your AWS KMS key for encryption. Now, you must append the key’s encryption policy to allow the S3 bucket and SNS topic to communicate securely via encryption.
Use the Search bar to quickly navigate to Key Management Service, or find it in the Services menu.
From the Customer Managed Keys list, select your AWS KMS alias.
First, copy the ARN and save it to a safe place as your AWS KMS Key ARN (you will need it in a later step). The format should look something like this:
arn:aws:kms:us-west-2:123456789012:key/123a4567-890b-1234-c5d6-7ef89012g345In the Key policy section, select Edit and append these JSON objects to the code.
Make sure to use your S3 Bucket ARN and SNS Topic ARN as the aws:SourceARN values.
Important: Did you use your S3 bucket ARN and SNS Topic ARN in the appended code? Check to be sure before continuing.
Select Save changes.
Step 7: Create the SQS Queue
Next, you will create a dedicated SQS queue to receive messages from the SNS topic, and edit the access policy to allow the SNS topic to send messages to it. Expel will use this queue to poll for notifications of new CloudTrail data, and then will update Workbench accordingly.
Use the Search bar to quickly navigate to Simple Queue Service (SQS), or find it in the Services menu.
Select Create queue.
In the Details section:
Leave Standard as the Type.
Enter a name in the Name field.
In the Configuration section:
Change the Message Retention period to 7 days.
Leave all other defaults.
In the Encryption section:
Leave Server-side encryption as Enabled.
Choose AWS Key Management Service key (SSE-KMS) as the encryption key type.
Choose your AWS KMS Alias from the Customer master key dropdown.
Leave the data key reuse period as the default.
In the Access policy section:
Select Advanced.
First, go to the Resource value and copy the ARN, then save it to a safe place as your SQS Queue ARN (you will need it for your new access policy).
Highlight and delete the existing policy and paste the below policy instead.
Make sure to use your SQS Queue ARN as the Resource value and your SNS Topic ARN as the aws:SourceARN value.
Important: Did you use your SQS Queue ARN and SNS Topic ARN in the new code? Check to be sure before continuing.
Leave the remaining sections as is and select Create queue.
Before leaving the confirmation screen, copy the URL and save it to a safe place as your SQS URL (you will need it in a later step).
Step 8: Create the SNS Subscription
Now that you have the SNS topic and SQS queue, and have also edited both of their access policies to allow for communication, you need to create a subscription within the SNS topic so that the topic can send events to the queue.
Use the Search bar to quickly navigate to Simple Notification Service (SNS), or find it in the Services menu.
Select Subscriptions.
Select Create subscription.
In the Details section:
Select your SNS Topic ARN.
Select Amazon SQS as the protocol.
Select your SQS Queue ARN as the endpoint.
Select the Enable raw message delivery checkbox.
Leave the remaining sections as is and select Create subscription.
Step 9: Enable S3 Event Notifications
Now that you've fully configured the communications between the SNS topic and SQS queue, you can create an event notification. This notification will tell the S3 bucket to send certain events (you will specify which ones) to the SNS topic whenever CloudTrail adds event logs to the bucket.
Use the Search bar to quickly navigate to S3, or find it in the Services menu.
Select your S3 bucket.
Select Properties.
Go to the Event Notifications section and select Create event notification. Then:
Enter an event name.
In the Event types section, use the checkbox to enable All object create events. Leave the rest of the boxes unchecked.
In the Destination section, select SNS topic and then choose your SNS topic from the dropdown.
Select Save changes.
Step 10: Set Up CloudFormation
Expel will authenticate its credentials using an IAM Role, and will be granted permissions to your AWS account(s) based on a corresponding IAM policy. You can complete this step most efficiently by using CloudFormation instead of doing a manual configuration via IAM.
Step 11: Add AWS CloudTrail as a Security Device in Workbench
Now, you can add a security device in Workbench to complete the integration.
In the side menu, navigate to Organization Settings > Security Devices.
Select Add Security Device.
In the search box, enter “AWS” and then select the AWS CloudTrail integration.
Select the bullets as follows:
“Are you using AWS organizations?” - AWS Organizations should leave it as Yes; single accounts should select No.
“Do you have an existing CloudTrail that you want Expel to reuse?” - select No.
“How would you like to connect?” - select Manual connection.
Select Save.
On the next screen, complete the fields as follows:
Name - enter a name that might help you more easily identify this integration, such as “CompanyName CloudTrail”; this name will display in Workbench under the Name column, and is a text string that you can filter on.
Location - enter the location of your integration, for example “cloud” or “AWS cloud” or “on prem;” this is also a text string that you can filter on, so we recommend being consistent with location naming across your Expel integrations.
Role ARN - enter the IAM Role ARN you saved earlier. Format:
arn:aws:iam::123456789012:role/RoleNameRole session name - enter a text string to label your IAM role session, such as "orgname-expel-trail-session".
AWS region - choose the AWS region where you created your configuration in AWS.
SQS URL - enter the SQS URL you copied and saved in a previous step.
Organization management account - If you use AWS Organizations, input your AWS Account ID; single account users can leave this field blank.
AWS OU ID - if you use AWS Organizations to centralize CloudTrail logs from multiple subsidiaries into a single S3 bucket, enter the AWS OU ID for the relevant subsidiary (format:
ou-abc1-defghi2j); otherwise, leave this field blank. This field tells our system to filter the logs based on that ID, ensuring that each subsidiary's Workbench instance only ingests and analyzes the logs relevant to its own accounts, which helps prevent any overlap of data.AWS OU Role ARN - if you entered an AWS OU ID, you will also need to enter the IAM Role ARN that contains the appropriate permissions. If you chose to add these permissions to your existing IAM Role in Step 10, enter the IAM Role ARN again here. If you chose to create a new IAM Role with those permissions, enter your AWS OU Role ARN. Otherwise, leave this field blank.
Select Save.
Your device should be created successfully within a few seconds. A few reminders:
After your connection is healthy, it will take some time for your device to begin polling and receiving data.
To check on the status, select the downward arrow for your device in the first column and choose View details.
Polling will happen first; data will be received after that. You must refresh the page to see updates.
If your device does not begin polling within 15 minutes, and does not begin receiving data within 30 minutes, contact our support team for help.
To check if alerts are coming through, navigate to Dashboards > Alert Analysis. Scroll to the device you want to check, and select the Expel Alerts tab to reveal more alert information. It can take 36 to 72 hours for alerts to appear after setup, as we tune your device.
Troubleshooting
S3 Event Notification Errors (Step 9)
This error is encountered when selecting Save changes in Step 9. It generally displays for one of the following reasons:
You left one of your ARN values out of a JSON object in a prior step, put an ARN in the wrong location, or formatted an ARN incorrectly.
The JSON objects were copied, appended, or formatted incorrectly in a prior step.
You used an S3 bucket name that someone else in the AWS ecosystem is already using (even if nobody at your organization is using it).
You have forgotten to enable something, or have configured something incorrectly, in one of the prior steps. Examples: Not choosing your AWS KMS key from the dropdown menu when setting up default encryption in step 4, or not using the same region throughout your AWS configuration.
S3 Bucket Naming
You must use an S3 bucket name that nobody else in the AWS ecosystem is using. You can avoid this problem by using the default name, or by appending your chosen name with the numerical values from the default name that is generated.
Appending JSON Files
Make sure to put this JSON snippet in the correct place, using a comma, and make sure the final bracket is still there. Lines 78-133 of your JSON code should look like this (the appended part is highlighted, beginning with the ,):
Reference
ARNs and URLs
This chart gives examples of ARNs and the SQS URL so you can check on the general formatting, and also tells you where to find any of the values if you’ve forgotten to copy and save them during the configuration process.
S3 Bucket ARN
S3 > Buckets > bucket name > Properties
arn:aws:s3:::MyS3BucketARN
SNS Topic ARN
Simple Notification Service > Topics > topic name > Details section
arn:aws:sns:us-east-1:123456789012:MyTopicName
AWS KMS Key ARN
Key Management Service > key alias > General configuration section
arn:aws:kms:us-west-2:123456789012:key/123a4567-890b-1234-c5d6-7ef89012g345
SQS Queue ARN
Simple Queue Service > queue name > Details section
arn:aws:sqs:us-east-1:123456789012:MySQSQueueName
SQS URL
Simple Queue Service > queue name > Details section
https://sqs.us-west-1.amazonaws.com/123456789012/MySQSQueueName
IAM Role ARN
IAM > Access Management > Roles > role name > Summary section
arn:aws:iam::123456789012:role/RoleName
(most users will look for the ExpelAssumeRole)
AWS Organization-Specific Values
This chart helps you locate the additional values you need if you are using AWS Organizations. The OU ID is only necessary if you use a single S3 bucket for multiple subsidiaries.
AWS Account ID
AWS Organizations Console, upper right of screen
1234-5678-9012
AWS OU ID
ou-abc1-defghi2j
(format is ou-rootid-ouid and this entire value should be entered into the Workbench security device)
Workbench GUID
The Workbench GUID is a unique alphanumeric value assigned by Expel to your organization.
Format
a123b456-7c89-0def-g1hi-2j3k45l6mn7o
Where to Find
Go to Organization Settings > My Organization.
On the organization's page, look for the Organization GUID and select the Copy button to copy the GUID.
Last updated
Was this helpful?

