Rego overview - AWS Prescriptive Guidance

Rego overview

Rego is a general-purpose policy language, which means that it works for any layer of the stack and any domain. The primary purpose of Rego is to accept JSON/YAML inputs and data that are evaluated to make policy-enabled decisions about infrastructure resources, identities, and operations. Rego enables you to write policy about any layer of a stack or domain without requiring a change or extension of the language. Here are some examples of decisions that Rego can make:

  • Is this API request allowed or denied?

  • What is the hostname of the backup server for this application?

  • What is the risk score for this proposed infrastructure change?

  • Which clusters should this container be deployed to for high availability?

  • What routing information should be used for this microservice?

To answer these questions, Rego employs a basic philosophy about how these decisions can be made. The two key tenets when drafting policy in Rego are:

  • Every resource, identity, or operation can be represented as JSON or YAML data.

  • Policy is logic that is applied to data.

Rego helps software systems make authorization decisions by defining logic about how inputs of JSON/YAML data are evaluated. Programming languages such as C, Java, Go, and Python are the usual solution to this problem, but Rego was designed to focus on the data and inputs that represent your system, and the logic for making policy decisions with this information.