Consul Enterprise on AWS Elastic Container Service (ECS)

You can run Consul Enterprise on ECS by specifying the Consul Enterprise Docker image in the Terraform module parameters.

Specify the Consul image

When you set up an instance of the mesh-task or gateway-task module, set the parameter consul_image to a Consul Enterprise image. The following example instructs the mesh-task module to import Consul Enterprise version 1.12.0:

  1. module "my_task" {
  2. source = "hashicorp/consul-ecs/aws//modules/mesh-task"
  3. version = "<latest version>"
  4. consul_image = "hashicorp/consul-enterprise:1.12.0-ent"
  5. ...
  6. }

Licensing

Warning: Consul Enterprise is currently only fully supported when ACLs are enabled.

Consul Enterprise requires a license. If running Consul on ECS with ACLs enabled, the license will be automatically pulled down from Consul servers.

Currently there is no capability for specifying the license when ACLs are disabled so if you wish to run Consul Enterprise clients then you must enable ACLs.

Running Open Source Consul Clients

You can operate Consul Enterprise servers with Consul OSS (open source) clients as long as the features you are using do not require Consul Enterprise client support. Admin partitions and namespaces, for example, require Consul Enterprise clients and are not supported with Consul OSS.

Feature Support

Consul on ECS supports the following Consul Enterprise features. If you are only using features that run on Consul servers, then you can use an OSS client in your service mesh tasks on ECS. If client support is required for any of the features, then you must use a Consul Enterprise client in your mesh-tasks.

FeatureSupportedDescription
Automated Backups/Snapshot AgentYes*Running the snapshot agent on ECS is not currently supported but you are able to run the snapshot agent alongside your Consul servers on VMs.
Automated UpgradesYes (servers)This feature runs on Consul servers.
Enhanced Read ScalabilityYes (servers)This feature runs on Consul servers.
Single Sign-On/OIDCYes (servers)This feature runs on Consul servers.
Redundancy ZonesYes (servers)This feature runs on Consul servers.
Advanced Federation/Network AreasYes (servers)This feature runs on Consul servers.
SentinelYes (servers)This feature runs on Consul servers.
Network SegmentsNoCurrently there is no capability to configure the network segment Consul clients on ECS run in.
NamespacesYesThis feature requires Consul Enterprise servers. OSS clients can register into the default namespace. Registration into a non-default namespace requires a Consul Enterprise client.
Admin PartitionsYesThis feature requires Consul Enterprise servers. OSS clients can register into the default admin partition. Registration into a non-default partition requires a Consul Enterprise client.
Audit LoggingYesThis feature requires Consul Enterprise clients.

Admin Partitions and Namespaces

Consul on ECS supports admin partitions and namespaces when Consul Enterprise servers and clients are used. These features have the following requirements:

  • ACLs must be enabled.
  • ACL controller must run in the ECS cluster.
  • mesh-task must use a Consul Enterprise client image.
  • gateway-task must use a Consul Enterprise client image.

The ACL controller manages configuration of the AWS IAM auth method on the Consul servers. It ensures unused tokens created by tasks are cleaned up. It also creates admin partitions and namespaces if they do not already exist.

Note: The ACL controller does not delete admin partitions or namespaces once they are created.

Each ACL controller manages a single admin partition. Consul on ECS supports one ACL controller per ECS cluster; therefore, the administrative boundary for admin partitions is one admin partition per ECS cluster.

The following example demonstrates how to configure the ACL controller to enable admin partitions and manage an admin partition named my-partition. The consul_partition field is optional and if it is not provided when consul_partitions_enabled = true, will default to the default admin partition.

  1. module "acl_controller" {
  2. source = "hashicorp/consul-ecs/aws//modules/acl-controller"
  3. ...
  4. consul_partitions_enabled = true
  5. consul_partition = "my-partition"
  6. }

Services are assigned to admin partitions and namespaces through the use of task tags. The mesh-task module automatically adds the necessary tags to the task definition. If the ACL controller is configured for admin partitions, services on the mesh will always be assigned to an admin partition and namespace. If the mesh-task does not define the partition it will default to the default admin partition. Similarly, if a mesh-task does not define the namespace it will default to the default namespace.

The following example demonstrates how to create a mesh-task assigned to the admin partition named my-partition, in the my-namespace namespace.

  1. module "my_task" {
  2. source = "hashicorp/consul-ecs/aws//modules/mesh-task"
  3. family = "my_task"
  4. ...
  5. consul_image = "hashicorp/consul-enterprise:<version>-ent"
  6. consul_partition = "my-partition"
  7. consul_namespace = "my-namespace"
  8. }

Audit Logging

Consul on ECS supports audit logging when using Consul Enterprise clients. This feature has the following requirements:

  • ACLs must be enabled.
  • mesh-task must use a Consul Enterprise image.
  • gateway-task must use a Consul Enterprise image.

To enable audit logging, set audit_logging = true when configuring the client.

  1. module "my_task" {
  2. source = "hashicorp/consul-ecs/aws//modules/mesh-task"
  3. family = "my_task"
  4. ...
  5. consul_image = "hashicorp/consul-enterprise:<version>-ent"
  6. audit_logging = true
  7. }