Using Open Policy Agent (OPA) for Cloud Security and Compliance

Just like the challenges of managing large cloud infrastructure operations led to the development of infrastructure as code, ensuring the security and compliance of those environments led to policy as code. Cloud infrastructure environments are simply too vast, complex and dynamic to address with traditional security approaches such as manual audits and checklists.


Unfortunately, most policy as code languages are proprietary, closed-source ones offered by cloud vendors. These lock in customers, are incompatible with other policy frameworks the enterprise may be using, and it can be a real struggle to apply them to specific use cases.


Open Policy Agent (OPA) is an open source general-purpose policy engine, and Rego is OPA’s declarative policy language. Combined with Fugue, it provides maximum flexibility when implementing cloud infrastructure policy. The Cloud Native Computing Foundation (CNCF) accepted OPA as an incubation-level hosted project in April 2019.


We’ve been using OPA and Rego at Fugue as the policy-as-code framework in our SaaS solution for cloud security and compliance, and it’s simply amazing. Much of the focus of OPA has been on developing access policies for Kubernetes, but we’ve been leveraging it substantially for a wider variety of cloud infrastructure use cases on Amazon Web Services (AWS) and Microsoft Azure. You can read our announcement here.


Note: Fugue co-founder and CTO Josh Stella will be speaking at the OPA Summit at KubeCon  NA on November 18 on “High Performance Rego at Scale with Fugue”.


By adopting of OPA and Rego, we’ve been able to provide the powerful and flexible policy as code capabilities for our customers, including the ability to quickly and easily create custom cloud infrastructure policies.


Fugue’s custom rules capabilities that leverage OPA enable users to:

  • Build and manage custom, user-defined cloud infrastructure rules in OPA Rego via the Fugue API, CLI, and web interface
  • Validate and test custom rules while they are being written with helpful errors that save time
  • Continuously validate and report on compliance for custom rules and out-of-the-box policy frameworks


Just a few examples of custom policies using OPA with Fugue include:


  • Check for public and unencrypted S3 buckets
  • Which cloud regions are allowed
  • Which machine images (e.g. AMIs) are allowed
  • Make sure VPC flow logs are configured
  • Which instance sizes (e.g. EC2) are allowed
  • Check for least permissions in IAM policies
  • Which ingress rules are allowed for Security Groups

For example, if a security group should not allow port 9200 to be open to the world, the rule can be expressed like this:




Most organizations also need to adhere to one or more compliance frameworks, so Fugue provides out-of-the-box support using OPA for CIS Foundations Benchmarks (AWS and Azure), GDPR, HIPAA, ISO 27001, NIST 800-53, PCI, and SOC 2.


Fugue is running millions of security rule evaluations every day using OPA, so we've put a lot of work into developer tooling and will be contributing all of that back to the open source community. We’re excited about OPA and the opportunity to get more involved in this important open source project.


While you’re here…

Fugue is cloud security for developers, by developers. We make tools that bake security into the entire system lifecycle on the cloud. We’d love to show you how.


With Fugue, you can:

  1. Validate cloud infrastructure compliance for custom rules and a number of out-of-the-box policy frameworks like CIS Foundations Benchmark, HIPAA, PCI, SOC 2, NIST 800-53, ISO 27001, and GDPR.
  2. Get complete visibility into your cloud environment and configurations with dynamic visualization tools.
  3. Protect against cloud misconfiguration with baseline enforcement to make security critical cloud infrastructure self-healing.
  4. Shift Left on cloud security and compliance with CI/CD integration to help your developers move fast and safely.
  5. Get continuous compliance visibility and reporting across your entire enterprise cloud footprint.

Give Fugue a try with a free trial or schedule a free half-hour workshop to learn how Fugue can help you manage your cloud security posture. 



Secure Your Cloud

Find Security and compliance violations in your cloud infrastructure and ensure they never happen again.