Deleting a CloudTrail Trail - AWS SDK for Ruby

Deleting a CloudTrail Trail

This example uses the delete_trail method to delete a CloudTrail trail in the us-west-2 region. It requires one input, the name of the trail.

Choose Copy to save the code locally.

Create the file delete_trail.rb with the following code.

=begin ############################################################################### Purpose: Deletes a trail in AWS CloudTrail. Prerequisites: - You must have an AWS account. For more information, see "How do I create and activate a new Amazon Web Services account" on the AWS Premium Support website. - This code uses default AWS access credentials. For more information, see "Configuring the AWS SDK for Ruby" in the AWS SDK for Ruby Developer Guide. Running the code: To run this code, use RSpec. For example: rspec aws-ruby-sdk-cloudtrail-example-delete-trail.rb -f d Additional information: - As an AWS best practice, grant this code least privilege, or only the permissions required to perform a task. For more information, see "Grant Least Privilege," in the AWS Identity and Access Management User Guide.

See the complete example on GitHub.