View a markdown version of this page

Working with AWS CloudTrail and AWS CloudHSM - AWS CloudHSM

Working with AWS CloudTrail and AWS CloudHSM

AWS CloudHSM is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in AWS CloudHSM. CloudTrail captures all API calls for AWS CloudHSM as events. The calls captured include calls from the AWS CloudHSM console and code calls to the AWS CloudHSM API operations. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for AWS CloudHSM. 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 CloudHSM, 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. For a full list of AWS CloudHSM API operations, see Actions in the AWS CloudHSM API Reference.

AWS CloudHSM information in CloudTrail

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

CloudTrail logs all AWS CloudHSM operations, including read-only operations, such as DescribeClusters and ListTags, and management operations, such as InitializeCluster, CreatHsm, and DeleteBackup.

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 AWS CloudHSM 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 AWS CloudHSM CreateHsm action.

{ "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "AROAJZVM5NEGZSTCITAMM:ExampleSession", "arn": "arn:aws:sts::111122223333:assumed-role/AdminRole/ExampleSession", "accountId": "111122223333", "accessKeyId": "ASIAIY22AX6VRYNBGJSA", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2017-07-11T03:48:44Z" }, "sessionIssuer": { "type": "Role", "principalId": "AROAJZVM5NEGZSTCITAMM", "arn": "arn:aws:iam::111122223333:role/AdminRole", "accountId": "111122223333", "userName": "AdminRole" } } }, "eventTime": "2017-07-11T03:50:45Z", "eventSource": "cloudhsm.amazonaws.com", "eventName": "CreateHsm", "awsRegion": "us-west-2", "sourceIPAddress": "205.251.233.179", "userAgent": "aws-internal/3", "requestParameters": { "availabilityZone": "us-west-2b", "clusterId": "cluster-fw7mh6mayb5" }, "responseElements": { "hsm": { "eniId": "eni-65338b5a", "clusterId": "cluster-fw7mh6mayb5", "state": "CREATE_IN_PROGRESS", "eniIp": "10.0.2.7", "hsmId": "hsm-6lz2hfmnzbx", "subnetId": "subnet-02c28c4b", "availabilityZone": "us-west-2b" } }, "requestID": "1dae0370-65ec-11e7-a770-6578d63de907", "eventID": "b73a5617-8508-4c3d-900d-aa8ac9b31d08", "eventType": "AwsApiCall", "recipientAccountId": "111122223333" }

AWS CloudHSM 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 CloudHSM logs all control plane operations as management events. For a list of the AWS CloudHSM control plane operations that AWS CloudHSM logs to CloudTrail, see Actions in the AWS CloudHSM API Reference.

AWS CloudHSM service events in CloudTrail

AWS CloudHSM logs service events to CloudTrail when the service performs actions on your resources automatically. These events may not be triggered directly by a call to a public AWS CloudHSM API. For these events, the eventType field is AwsServiceEvent.

The following are the service events that AWS CloudHSM logs to CloudTrail.

  • DeleteBackup – Logged when AWS CloudHSM automatically deletes a backup based on your backup retention policy.

  • BackupDeletedPermanently – Logged when a PENDING_DELETION backup is permanently purged and can no longer be restored.

  • MigrationStart – Logged when an HSM type migration begins for a cluster.

  • MigrationEnd – Logged when an HSM type migration completes for a cluster.

  • RollbackStart – Logged when an HSM type migration rollback begins for a cluster.

  • RollbackEnd – Logged when an HSM type migration rollback completes for a cluster.

You can identify AWS CloudHSM service events in CloudTrail logs by the following attribute values:

  • eventSource: cloudhsm.amazonaws.com

  • eventType: AwsServiceEvent