Logging connections, billing, and workflow action API calls in AWS CloudTrail - Amazon CodeCatalyst

Logging connections, billing, and workflow action API calls in AWS CloudTrail

When you perform actions in Amazon CodeCatalyst that manage interactions between CodeCatalyst and AWS accounts, those actions are recorded as events for CodeCatalyst API operations and are logged in the AWS accounts where they occur. These include actions for AWS account connections, billing activity, and workflow activity where actions in CodeCatalyst and workflows are implemented in API calls in AWS.

Actions that occur in connected AWS accounts are monitored in those accounts with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in CodeCatalyst that occurs in connected AWS accounts. CloudTrail captures API calls for CodeCatalyst that occur in those connected AWS accounts as events. The calls captured include calls from the CodeCatalyst console and code calls to the CodeCatalyst API operations. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for CodeCatalyst. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in Event history in the AWS account where the event took place. Using the information collected by CloudTrail, you can determine the request that was made to CodeCatalyst, the IP address from which the request was made, who made the request, when it was made, and additional details.

To learn more about CloudTrail, see the AWS CloudTrail User Guide.


To review events logged in a CodeCatalyst space, use the AWS CLI and the aws codecatalyst list-event-logs command. For more information, see Viewing Amazon CodeCatalyst events in a space.

CodeCatalyst information in CloudTrail

CloudTrail is enabled on your AWS account when you create the account. When activity originates in CodeCatalyst that causes activity in a connected AWS account, that activity is recorded in a CloudTrail event along with other AWS service events in Event history. You can view, search, and download recent events in your AWS account. For more information, see Viewing events with CloudTrail Event history.

For an ongoing record of events in your AWS account, including events for CodeCatalyst activity in the AWS account, create a trail. A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. By default, when you create a trail in the console, the trail applies to all AWS Regions. The trail logs events from all Regions in the AWS partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other AWS services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following:

CodeCatalyst supports logging the following actions as events in CloudTrail log files.

The following are examples of events in AWS that are related to actions in CodeCatalyst for account connections or billing:

  • AcceptConnection

  • AssociateIAMRoletoConnection

  • DeleteConnection

  • DissassociateIAMRolefromConnection

  • GetBillingAuthorization

  • GetConnection

  • GetPendingConnection

  • ListConnections

  • ListIAMRolesforConnection

  • PutBillingAuthorization

  • RejectConnection

Events for resources that are used in CodeCatalyst workflow actions that occur in a connected AWS account will be logged as events in that AWS account. For example, if a workflow action creates a AWS CloudFormation stack, that event will be logged in the AWS account, and the value of the ARN will be the Amazon Resource Name (ARN) of the service role for CodeCatalyst used for the action. For more information, see Identity and Access Management and Amazon CodeCatalyst.

Every event or log entry contains information about who generated the request. The identity information helps you determine the following:

  • Whether the request was made with root or AWS Identity and Access Management (IAM) user credentials.

  • Whether the request was made with temporary security credentials for a role or federated user.

  • Whether the request was made by another AWS service.

For more information, see the CloudTrail userIdentity element.

Understanding CodeCatalyst connections events in AWS

A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. CloudTrail log files contain one or more log entries. An event represents a single request from any source and includes information about the requested action, the date and time of the action, request parameters, and so on. CloudTrail log files aren't an ordered stack trace of the public API calls, so they don't appear in any specific order.

The following example shows a CloudTrail log entry that demonstrates the action.

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAI44QH8DHBEXAMPLE", "arn": "role-ARN", "accountId": "account-ID", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AKIAI44QH8DHBEXAMPLE", "arn": "role-ARN", "accountId": "account-ID", "userName": "user-name" }, "webIdFederationData": {}, "attributes": { "creationDate": "2022-09-06T15:04:31Z", "mfaAuthenticated": "false" } } }, "eventTime": "2022-09-06T15:08:43Z", "eventSource": "account-ID", "eventName": "ListConnections", "awsRegion": "us-west-2", "sourceIPAddress": "", "userAgent": "aws-cli/1.18.147 Python/2.7.18 Linux/5.4.207-126.363.amzn2int.x86_64 botocore/1.18.6", "requestParameters": null, "responseElements": null, "requestID": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "eventID": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "readOnly": true, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "account-ID", "eventCategory": "Management" }