Logging Amazon AppConfig API calls using Amazon CloudTrail
Amazon AppConfig is integrated with Amazon CloudTrail, a service that provides a record of actions taken by a user, role, or an Amazon service in Amazon AppConfig. CloudTrail captures all API calls for Amazon AppConfig as events. The calls captured include calls from the Amazon AppConfig console and code calls to the Amazon AppConfig API operations. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for Amazon 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 Amazon 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 Amazon CloudTrail User Guide.
Amazon AppConfig information in CloudTrail
CloudTrail is enabled on your Amazon Web Services account when you create the account. When activity occurs in Amazon AppConfig, that activity is recorded in a CloudTrail event along with other Amazon service events in Event history. You can view, search, and download recent events in your Amazon Web Services account. For more information, see Viewing events with CloudTrail Event history.
For an ongoing record of events in your Amazon Web Services account, including events for Amazon 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 Amazon Web Services Regions. The trail logs events from all Regions in the Amazon partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other Amazon services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following:
All Amazon AppConfig actions are logged by CloudTrail and are documented in the Amazon 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 Amazon 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 Amazon service.
For more information, see the CloudTrail userIdentity element.
Amazon 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
Amazon CloudTrail Pricing
You can log data events for the Amazon AppConfig resource types by using the CloudTrail console, Amazon CLI, or CloudTrail API operations. The table in this section shows the resource types available for Amazon 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.
-
Choose Data events to log data events.
-
From the Data event type list, choose Amazon AppConfig.
-
Choose the log selector template you want to use. You can log all data events for the resource type, log all
readOnly
events, log allwriteOnly
events, or create a custom log selector template to filter on thereadOnly
,eventName
, andresources.ARN
fields. -
For Selector name, enter AppConfigDataEvents. For information about enabling Amazon CloudWatch Logs for your data event trail, see Logging metrics for Amazon AppConfig data plane calls.
-
-
To log data events using the Amazon CLI, configure the
--advanced-event-selectors
parameter to set theeventCategory
field equal toData
and theresources.type
field equal to the resource type value (see table). You can add conditions to filter on the values of thereadOnly
,eventName
, andresources.ARN
fields.-
To configure a trail to log data events, run the put-event-selectors command. For more information, see Logging data events for trails with the Amazon CLI.
-
To configure an event data store to log data events, run the create-event-data-store command to create a new event data store to log data events, or run the update-event-data-store command to update an existing event data store. For more information, see Logging data events for event data stores with the Amazon CLI.
-
The following table lists the Amazon 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 Amazon 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* |
---|---|---|
Amazon 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.
Amazon AppConfig management events in CloudTrail
Management events provide information about management operations that are performed on resources in your Amazon account. These are also known as control plane operations. By default, CloudTrail logs management events.
Amazon AppConfig logs all Amazon AppConfig control plane operations as management events. For a list of the Amazon AppConfig control plane operations that Amazon AppConfig logs to CloudTrail, see the Amazon AppConfig API Reference.
Understanding Amazon 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": "203.0.113.0", "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" } }