Install the ACL Controller

    • Your application tasks must include certain tags to be compatible with the ACL controller. Refer to the Task Tags section of the installation page.
    • You should be familiar with configuring Consul’s secure features, including how to create ACL tokens and policies. Refer to the for an introduction and the ACL system documentation for more information.
    • If you are using Consul with multiple ECS clusters, each cluster requires its own instance of the ACL controller.

    Before deploying the ACL controller for the first time, you must from Consul in AWS Secrets Manager.

    You must create a task definition to deploy the ACL controller in your ECS cluster. The ACL controller must run in the same ECS cluster that hosts your service mesh application tasks.

    The following example shows how the task definition should be configured for the ACL controller.

    1. {
    2. "family": "my-consul-acl-controller",
    3. "networkMode": "awsvpc",
    4. "containerDefinitions": [
    5. {
    6. "name": "acl-controller",
    7. "image": "public.ecr.aws/hashicorp/consul-ecs:<CONSUL_ECS_VERSION>",
    8. "essential": true,
    9. "command": ["acl-controller", "-iam-role-path", "/consul-ecs/"],
    10. "secrets": [
    11. {
    12. "name": "CONSUL_HTTP_TOKEN",
    13. "valueFrom": "arn:aws:secretsmanager:us-west-2:000000000000:secret:my-consul-bootstrap-token"
    14. },
    15. "name": "CONSUL_CACERT_PEM",
    16. "valueFrom": "arn:aws:secretsmanager:us-west-2:000000000000:secret:my-consul-ca-cert"
    17. }
    18. ],
    19. "environment": [
    20. {
    21. "name": "CONSUL_HTTP_ADDR",
    22. "value": "<Consul server HTTP API address>"
    23. }
    24. ]
    25. }
    26. ]
    27. }

    You must include the following top-level fields.

    Field nameTypeDescription
    familystringThe task family name of your choice.
    networkModestringMust be awsvpc, which is the only network mode supported by Consul on ECS.

    The following CLI options are available in the command field of the container definition.

    FlagTypeDescription
    -iam-role-pathstringSpecifies the path to IAM roles trusted by the AWS IAM auth method created by the controller.
    -log-levelstringThe log level for the ACL controller. Can be set to DEBUG for additional detail.

    The following describes the entries to include in the secrets list.

    Once the task definition is created, define an ECS service in order to start an ACL controller task.

    The following example contains the recommended settings for the ACL controller. Refer to the ECS service documentation to complete the remaining details for your use case.

    1. {
    2. "cluster": "<Your ECS cluster ARN>"
    3. "desiredCount": 1,
    4. "launchType": "FARGATE",
    5. "serviceName": "my-acl-controller",
    6. "taskDefinition": "<task definition ARN>",
    7. ...
    8. }
    Field nameTypeDescription
    clusterstringSet to your ECS cluster name or ARN. This must be the same ECS cluster where your service mesh applications run.
    desiredCountintegerMust be 1. Only one instance of the ACL controller should run per ECS cluster.
    launchTypestringConsul on ECS supports both the FARGATE and EC2 launch types.
    stringThe service name of your choice.
    taskDefinitionstringMust be set to the ACL controller .

    The following example shows the policy needed for the ECS task role for the ACL controller. This grants the ACL controller permission to list tasks, describe tasks, and read and update secrets.

    1. {
    2. "Version": "2012-10-17",
    3. "Statement": [
    4. "Effect": "Allow",
    5. "Action": [
    6. "ecs:ListTasks",
    7. "ecs:DescribeTasks"
    8. ],
    9. "Resource": ["*"]
    10. }
    11. ]
    12. }

    The following are the required permissions.

    Execution Role Policy

    The following IAM policy document allows ECS to retrieve secrets needed to start the ACL controller task from AWS Secrets Manager, including the ACL bootstrap token.

    The following example shows the policy needed for the execution role.

    1. {
    2. "Version": "2012-10-17",
    3. "Statement": [
    4. {
    5. "Effect": "Allow",
    6. "Action": [
    7. "secretsmanager:GetSecretValue"
    8. ],
    9. "Resource": [
    10. "arn:aws:secretsmanager:us-west-2:000000000000:secret:my-consul-bootstrap-token",
    11. "arn:aws:secretsmanager:us-west-2:000000000000:secret:my-consul-ca-cert"
    12. ]
    13. }
    14. ]
    15. }
    ActionResourceDescription
    secretsmanager:GetSecretValueAllow ECS to retrieve this secret and inject the secret into the task.