Logging OpsWorks for Puppet Enterprise API Calls with AWS CloudTrail - AWS OpsWorks

Logging OpsWorks for Puppet Enterprise API Calls with AWS CloudTrail


The AWS OpsWorks for Puppet Enterprise service reached end of life on March 31, 2024 and has been disabled for both new and existing customers. We strongly recommend customers migrate their workloads to other solutions as soon as possible. For information about how to migrate your existing Puppet Enterprise servers, see How to migrate an OpsWorks for Puppet Enterprise server to Amazon Elastic Compute Cloud (Amazon EC2). If you have questions about migration, reach out to the AWS Support Team on AWS re:Post or through AWS Premium Support.

OpsWorks for Puppet Enterprise is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in OpsWorks for Puppet Enterprise. CloudTrail captures all API calls for OpsWorks for Puppet Enterprise as events, including calls from the OpsWorks for Puppet Enterprise console and from code calls to the OpsWorks for Puppet Enterprise APIs. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for OpsWorks for Puppet Enterprise. 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 OpsWorks for Puppet Enterprise, 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.

OpsWorks for Puppet Enterprise Information in CloudTrail

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

All OpsWorks for Puppet Enterprise actions are logged by CloudTrail and are documented in the OpsWorks for Puppet Enterprise API Reference. For example, calls to the CreateServer, CreateBackup, and DescribeServers 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 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 OpsWorks for Puppet Enterprise 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 are not an ordered stack trace of the public API calls, so they do not appear in any specific order.

The following example shows a CloudTrail log entry for the OpsWorks for Puppet Enterprise CreateServer action.

{"eventVersion":"1.05", "userIdentity":{ "type":"AssumedRole", "principalId":"ID number:OpsWorksCMUser", "arn":"arn:aws:sts::831000000000:assumed-role/Admin/OpsWorksCMUser", "accountId":"831000000000","accessKeyId":"ID number", "sessionContext":{ "attributes":{ "mfaAuthenticated":"false", "creationDate":"2017-01-05T22:03:47Z" }, "sessionIssuer":{ "type":"Role", "principalId":"ID number", "arn":"arn:aws:iam::831000000000:role/Admin", "accountId":"831000000000", "userName":"Admin" } } }, "eventTime":"2017-01-05T22:18:23Z", "eventSource":"opsworks-cm.amazonaws.com", "eventName":"CreateServer", "awsRegion":"us-west-2", "sourceIPAddress":"", "userAgent":"console.amazonaws.com", "requestParameters":{ "serverName":"test-puppet-server", "engineModel":"Single", "engine":"Puppet", "instanceProfileArn":"arn:aws:iam::831000000000:instance-profile/aws-opsworks-cm-ec2-role", "backupRetentionCount":3,"serviceRoleArn":"arn:aws:iam::831000000000:role/service-role/aws-opsworks-cm-service-role", "engineVersion":"12", "preferredMaintenanceWindow":"Fri:21:00", "instanceType":"t2.medium", "subnetIds":["subnet-1e111f11"], "preferredBackupWindow":"Wed:08:00" }, "responseElements":{ "server":{ "endpoint":"test-puppet-server-xxxx8u4390xo6pd9.us-west-2.opsworks-cm.io", "createdAt":"Jan 5, 2017 10:18:22 PM", "serviceRoleArn":"arn:aws:iam::831000000000:role/service-role/aws-opsworks-cm-service-role", "preferredBackupWindow":"Wed:08:00", "status":"CREATING", "subnetIds":["subnet-1e111f11"], "engine":"Puppet", "instanceType":"t2.medium", "serverName":"test-puppet-server", "serverArn":"arn:aws:opsworks-cm:us-west-2:831000000000:server/test-puppet-server/8ezz7f6z-e91f-4z10-89z5-8c6219zzz09f", "engineModel":"Single", "backupRetentionCount":3, "engineAttributes":[ {"name":"PUPPET_ADMIN_PASSWORD","value":"*** Redacted ***"}, {"name":"PUPPET_API_CA_CERT","value":"*** Redacted ***"}, ], "engineVersion":"12.11.1", "instanceProfileArn":"arn:aws:iam::831000000000:instance-profile/aws-opsworks-cm-ec2-role", "preferredMaintenanceWindow":"Fri:21:00" } }, "requestID":"de7z64z9-d394-12ug-8081-7zz0386fbcb6", "eventID":"8z7z18dz-6z90-47bz-87cf-e8346428zzz3", "eventType":"AwsApiCall", "recipientAccountId":"831000000000" }