Logging AWS AppConfig API calls using AWS CloudTrail - AWS AppConfig

Logging AWS AppConfig API calls using AWS CloudTrail

AWS AppConfig is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in AWS AppConfig. CloudTrail captures all API calls for AWS AppConfig as events. The calls captured include calls from the AWS AppConfig console and code calls to the AWS AppConfig API operations. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for AWS AppConfig. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in Event history. Using the information collected by CloudTrail, you can determine the request that was made to AWS AppConfig, 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.

AWS AppConfig information in CloudTrail

CloudTrail is enabled on your AWS account when you create the account. When activity occurs in AWS AppConfig, 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 AWS AppConfig, 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:

All AWS AppConfig actions are logged by CloudTrail and are documented in the AWS AppConfig API Reference. For example, calls to the CreateApplication, GetApplication and ListApplications actions generate entries in the CloudTrail log files.

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.

AWS AppConfig data events in CloudTrail

Data events provide information about the resource operations performed on or in a resource (for example, retrieving the latest deployed configuration by calling GetLatestConfiguration). These are also known as data plane operations. Data events are often high-volume activities. By default, CloudTrail doesn’t log data events. The CloudTrail Event history doesn't record data events.

Additional charges apply for data events. For more information about CloudTrail pricing, see AWS CloudTrail Pricing.

You can log data events for the AWS AppConfig resource types by using the CloudTrail console, AWS CLI, or CloudTrail API operations. The table in this section shows the resource types available for AWS AppConfig.

  • To log data events using the CloudTrail console, create a trail or event data store to log data events, or update an existing trail or event data store to log data events.

    1. Choose Data events to log data events.

    2. From the Data event type list, choose AWS AppConfig.

    3. Choose the log selector template you want to use. You can log all data events for the resource type, log all readOnly events, log all writeOnly events, or create a custom log selector template to filter on the readOnly, eventName, and resources.ARN fields.

    4. For Selector name, enter AppConfigDataEvents. For information about enabling Amazon CloudWatch Logs for your data event trail, see Logging metrics for AWS AppConfig data plane calls.

  • To log data events using the AWS CLI, configure the --advanced-event-selectors parameter to set the eventCategory field equal to Data and the resources.type field equal to the resource type value (see table). You can add conditions to filter on the values of the readOnly, eventName, and resources.ARN fields.

The following table lists the AWS AppConfig resource types. The Data event type (console) column shows the value to choose from the Data event type list on the CloudTrail console. The resources.type value column shows the resources.type value, which you would specify when configuring advanced event selectors using the AWS CLI or CloudTrail APIs. The Data APIs logged to CloudTrail column shows the API calls logged to CloudTrail for the resource type.

Data event type (console) resources.type value Data APIs logged to CloudTrail*
AWS AppConfig AWS::AppConfig::Configuration

*You can configure advanced event selectors to filter on the eventName, readOnly, and resources.ARN fields to log only those events that are important to you. For more information about these fields, see AdvancedFieldSelector.

AWS AppConfig management events in CloudTrail

Management events provide information about management operations that are performed on resources in your AWS account. These are also known as control plane operations. By default, CloudTrail logs management events.

AWS AppConfig logs all AWS AppConfig control plane operations as management events. For a list of the AWS AppConfig control plane operations that AWS AppConfig logs to CloudTrail, see the AWS AppConfig API Reference.

Understanding AWS AppConfig log file entries

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 StartConfigurationSession action.

{ "eventVersion": "1.09", "userIdentity": { "type": "IAMUser", "principalId": "AIDACKCEVSQ6C2EXAMPLE", "arn": "arn:aws:iam::123456789012:user/Administrator", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": {}, "attributes": { "creationDate": "2024-01-11T14:37:02Z", "mfaAuthenticated": "false" } } }, "eventTime": "2024-01-11T14:45:15Z", "eventSource": "appconfig.amazonaws.com", "eventName": "StartConfigurationSession", "awsRegion": "us-east-1", "sourceIPAddress": "", "userAgent": "Boto3/1.34.11 md/Botocore#1.34.11 ua/2.0 os/macos#22.6.0 md/arch#x86_64 lang/python#3.11.4 md/pyimpl#CPython cfg/retry-mode#legacy Botocore/1.34.11", "requestParameters": { "applicationIdentifier": "rrfexample", "environmentIdentifier": "mexampleqe0", "configurationProfileIdentifier": "3eexampleu1" }, "responseElements": null, "requestID": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE", "eventID": "a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE", "readOnly": false, "resources": [ { "accountId": "123456789012", "type": "AWS::AppConfig::Configuration", "ARN": "arn:aws:appconfig:us-east-1:123456789012:application/rrfexample/environment/mexampleqe0/configuration/3eexampleu1" } ], "eventType": "AwsApiCall", "managementEvent": false, "recipientAccountId": "123456789012", "eventCategory": "Data", "tlsDetails": { "tlsVersion": "TLSv1.3", "cipherSuite": "TLS_AES_128_GCM_SHA256", "clientProvidedHostHeader": "appconfigdata.us-east-1.amazonaws.com" } }