7 min read

Leveraging AWS CloudTrail to fight ClickOps

Picture of Aharon Twizer
Aharon Twizer

CEO & Co-Founder

Aharon Twizer

Aharon Twizer

CEO & Co-founder

Picture of Aharon Twizer
Aharon Twizer

CEO & Co-Founder

ClickOps and AWS CloudTrail 

Remember the last time your colleague modified a resource directly in the AWS console, which led to a production issue?
Instances like these highlight why amending cloud resources directly through the AWS console, commonly called “ClickOps,” is not the best practice.
If you haven’t encountered such an issue yet, that’s great! But remember, ClickOps can be likened to riding a motorcycle—you either have had an accident or will have one in the future.
In this blog we will review AWS CloudTrail and how to fight ClickOps with best Practices.

📚 Not sure what ClickOps is? Here a full guide about it and how to face it

The Pitfalls of Direct AWS Console Access: ClickOps

Working directly from the AWS console can often bypass organizational policies and security controls, leading to significant risks.
Operations performed directly through the console may not undergo the same review and validation processes as those executed through Infrastructure-as-Code, potentially leading to misconfigurations and security breaches.
This approach also compromises your audit and compliance readiness. To maintain a well-managed Software Development Lifecycle (SDLC), it is crucial to avoid allowing engineers to change resources via ClickOps.
You may still use direct console access with read-only permissions, but avoid it for creating, updating, or deleting files.

Promoting Best Practices: The Shift to GitOps

To mitigate these risks, organizations are increasingly adopting a GitOps methodology. GitOps defines and modifies infrastructure through Git repositories, treating them as the source of truth. It enforces change reviews, version control, and full auditability.
By restricting AWS console permissions—ideally, to read-only access—organizations can ensure that all modifications undergo the proper review process, thereby maintaining security and compliance.

Think about how software deployment has evolved over the past 20 years. Would you let an R&D team run software updates directly from a local machine today? Probably not.

The same principles should apply to your infrastructure delivery as you have established processes and automation for software deployment.

Don’t misunderstand; removing AWS credentials from multiple engineers across an organization is not trivial. However, this shift is critical, especially when managing cloud infrastructure at scale across multiple accounts and even multiple cloud providers.

Detecting Unauthorized Operations, ClickOps: Leveraging AWS CloudTrail Logs

Now, let’s discuss how to track down ClickOps activity—identifying who’s using the AWS console and what changes they’re making directly through it. The critical tool for this task is AWS CloudTrail.

AWS CloudTrail is a powerful tool for governance, compliance, and operational and risk auditing of your AWS account. It captures every API call to AWS APIs, including those from the management console, SDKs, command line tools, and other AWS management interfaces.

Parsing AWS CloudTrail data isn’t straightforward. You need to sift through JSON files to pull out key details—who made the change, what resource they modified, and more.

Example of how a AWS CloudTrail event JSON might look:

 

6 Steps to leveraging AWS CloudTrail logs safeguard from ClickOps

We created a 6-step guide shows you how to use CloudTrail logs to detect manual console activity and help you to tighten control, and drive IaC adoption – without disrupting your workflows.

Step1: Parse and Analyze Events:

Start by analyzing AWS CloudTrail events to extract insights. Each AWS service may report slightly different fields to AWS CloudTrail , so normalizing this data for later querying is essential.

  • You’ll need to extract:
    • User Identity: Identify the IAM user/role involved in the operations. This might include handling edge cases like extracting session names with the user’s email for SSO roles rather than the role itself.
      Usually, you can use the userIdentity field for that. Still, there are all kinds of edge cases where this field might be empty, and then you’ll need a particular behavior for specific CloudTrail-logged events.
    • Action Taken: Identify the action the user performed.
    • Resource Amended: Identify the resource(s) involved. In cases where multiple resources are affected by a single action, establish a logic to determine the primary resource.
    • Operation Source: Determine where the action originated—was it from the AWS console, an infra-as-code tool, or an SDK call? This can be identified using fields like sessionCredentialFromConsole and analyzing the userAgent.

Step 2: Group Events by Resource

Group the events by resources to identify which are frequently modified directly from the console. These are prime candidates for management via Terraform as part of your Infrastructure as Code (IaC) strategy.

Step 3: Group Events by User:

This helps identify which teams or individuals need more training on GitOps and Terraform practices.

Step 4: Set Up a Dashboard

Create a dashboard to filter and query events by user, resource, action, and time range. This tool will aid in tracking and investigating production issues.

Step 5: Set Up Alerts

With the data organized, alerts for specific resources or operation thresholds are set up. For instance, alert if your Production RDS is manually altered from the console or if there are over 20 ClickOps operations within 24 hours. Connect these alerts to your alerting system or a Slack/Teams channel. Ensure there is a straightforward procedure for handling these alerts to effectively reduce ClickOps activity in your account.

Step 6: Generate Monthly Reports

Use the collected data to generate monthly reports to share with your team or management about the success of your GitOps strategy and identify areas needing additional training on infra-as-code and GitOps practices. These reports can also support the case for removing console permissions, mainly when an account is fully managed by infra-as-code.

 

Reaching the Oasis: Removing Direct AWS Console Access

After implementing the previous steps, you now have:

  • An easy-to-use dashboard to visualize ClickOps activity.
  • Alerts for any abnormal ClickOps activities.
  • Monthly reports showcasing general trends of your GitOps versus ClickOps migration.

This setup signals the right time to start removing console access permissions. Carefully carry out this process to avoid disrupting your teams’ daily operations—it’s not a one-day task.

When your dashboard and reports confirm that specific areas of your cloud environment no longer rely on the AWS console for management, begin removing “write” permissions from console users. Still, keep a “break-glass” user reserved strictly for emergencies, so you can handle critical situations effectively.

Conclusion: Fighting ClickOps

Moving away from direct AWS console operations and adopting a GitOps methodology enhances your security posture and aligns with best practices for cloud governance. By leveraging tools like AWS CloudTrail and implementing strict access controls, organizations can detect unauthorized operations and ensure their cloud environments are secure, compliant, and optimized for operational excellence.

About ControlMonkey

ControlMonkey is the most comprehensive Terraform Automation Platform, providing users with a 360 solution to manage the cloud at scale with Terraform.
You get a single control plane with a complete cloud inventory and alerts on ClickOps activity. It also offers Terraform code generation for your existing cloud environments, as well as drift detection and remediation.

With ControlMonkey, you can standardize your infrastructure delivery at scale with out-of-the-box GitOps Terraform CI/CD, incorporating cost, security, and compliance policies, plus a self-service catalog of pre-defined, compliant infrastructure blueprints for other teams in the organization to spin up infrastructure, enabling agility without sacrificing control.

ControlMonkey verifies configurations and confirms only intended resources run in your cloud.

Book a 1:1 consultation session with our Terraform Experts to learn more about our Terraform Automation platform.

Recommended from Control Monkey
7 min read
Your Enterprise Disaster Recovery Plan Might Be a Disaster

Every major enterprise has a cloud disaster recovery plan–not news. What is news? Most of them are disasters. Or, at...

Aharon Twizer

Aharon Twizer

CEO & Co-founder

Picture of Aharon Twizer
Aharon Twizer

CEO & Co-Founder

Picture of Aharon Twizer
Aharon Twizer

CEO & Co-Founder

6 min read
Cloud Governance Best Practices: 5 Ways to Prevent Drift

As a DevOps professional, you’ve likely spent weeks carefully designing and documenting your infrastructure to ensure everything runs smoothly. But...

Ori Yemini

Ori Yemini

CTO & Co-Founder

Author picture
7 min read
What to Do When Atlantis Doesn’t Meet Your Scale

Scaling Challenges with Atlantis and when to start looking for Atlantis alternatives Terraform is a crown jewel when it comes...

Ori Yemini

Ori Yemini

CTO & Co-Founder

Picture of Ori Yemini
Ori Yemini

CTO & CO-Founder

Ori Yemini

CTO & CO-Founder

8 min read
How to Become a Director of Devops​

Driving DevOps career growth, skills development and cloud governance Are you a DevOps engineer today and you are looking to...

Zack Bentolila

Zack Bentolila

Marketing Director

Picture of Zack Bentolila
Zack Bentolila

Marketing Director

Zack Bentolila

Marketing Director

[sticky_post_wrapper]
Compliant AWS environments in minutes, with Self-service Infrastructure
Learn how to enable other teams such as Dev and QA to launch pre-defined compliant AWS environments in minutes, by using Terraform.

Contact us

We look forward to hearing from you

ControlMonkey
AWS Governance & DevOps Productivity with Terraform

Learn how how to shift-left cloud governance with Terraform in this webinar brought to you by AWS and ControlMonkey.

We look forward to hearing from you!

ControlMonkey

Terraform Best Practices with ControlMonkey Webinar

Check out our latest webinar with DoIT International.

In this webinar we showcase together with DoIT how ControlMonkey is helping DevOps teams to make the transition from ClickOps to GitOps easily with Terraform.

This website uses cookies. We use cookies to ensure that we give you the best experience on our website. Privacy policy