Deploy on AWS ECS
Your systems are in AWS and you want the outpost there too, created and removed like any other stack. The Deploy outpost drawer gives you a CloudFormation template that does the whole job: one instance, one ECS service, the outpost running on it.
It uses ECS with EC2 capacity, not Fargate, on purpose. The outpost runs each scan as containers on the host's Docker, and Fargate gives a task no Docker to drive. ECS here is the way the outpost is started, restarted and logged; the scans themselves run on the instance's Docker, not as ECS tasks.
Prerequisites
- A Dwaar role that holds
outposts:create, such as Security admin. - Rights to create a CloudFormation stack with IAM resources in the AWS account.
- A VPC with subnets whose traffic can reach the internet: through a NAT gateway, through an HTTPS proxy, or with a public IP in a public subnet. Nothing needs to reach the instance.
Steps
-
Open Scan Center, then Outposts, and choose Deploy outpost.
-
Name the outpost, and under Runs on choose AWS ECS. Set its Scan concurrency and Memory overcommit under Capacity. With Dwaar AI on, Ask Dwaar can also recommend an instance type, and its counts include the instance's CPUs as well as its memory: Use these values then fills in the stack's
InstanceTypeandArchitecture. -
Choose Create enrollment token and keep the token for the stack. It works for one hour, so create the stack within the hour.
-
On Deploy, choose Download template. It saves as
dwaar-outpost-ecs.yaml. The drawer lists every parameter with your console's address, the name and the token filled in. -
Deploy the stack with the command the drawer shows, from the directory where you saved the template. Replace the VPC and subnet ids.
aws cloudformation deploy --stack-name dwaar-outpost --template-file dwaar-outpost-ecs.yaml --capabilities CAPABILITY_IAM \--parameter-overrides ConsoleUrl=<console-url> EnrollmentToken=<enrollment-token> OutpostName=<outpost-name> \VpcId=vpc-<id> SubnetIds=subnet-<id>,subnet-<id>You can also upload the template in the AWS console, under CloudFormation, then Create stack. When the drawer offers Launch stack, it opens that page with the console's address and the name filled in. Paste the token into
EnrollmentTokenyourself: the link never carries it. -
Back in the drawer, Wait for it turns Online a few minutes after the stack completes.
What the stack creates
| Resource | Notes |
|---|---|
| An ECS cluster | Unless you name one in ExistingClusterName. |
| One EC2 instance in an Auto Scaling group of one | ECS optimised Amazon Linux 2023, arm64 or x86_64. An encrypted gp3 disk. Instance metadata requires IMDSv2 with one hop, so scan containers cannot reach the instance's role. |
| A security group | No inbound rule. Outbound to anywhere, so narrow it, or the subnets' routes, to the destinations in Plan an outpost if your rules require it. |
| An ECS service running one outpost task | The Docker socket and /var/lib/outpost mounted from the instance. aws ecs execute-command is enabled so you can run outpost status inside it. |
| A Secrets Manager secret | Holds the enrollment token, so it never appears as plain text in the task definition. It is spent on the first start. |
| Three IAM roles | The instance's (ECS agent and Session Manager), the task execution role (pulls the image, writes logs, reads the secret) and the task role (the outpost's identity, below). |
| A log group | /dwaar/outpost/<stack-name>, kept for 30 days. |
Parameters
| Parameter | Default | Value |
|---|---|---|
ConsoleUrl | Your Dwaar console. Filled in by the drawer. | |
EnrollmentToken | The one-time token. Hidden in the AWS console. | |
OutpostName | the stack name | How it shows in Dwaar. |
Image | the current outpost image | Its architecture must match Architecture. |
MaxJobs | empty | Empty follows the outpost's Scan concurrency in the console. A number from 1 to 16 overrides it on this stack, and only a stack update changes it then. |
AssumeRoleArns | empty | The roles of AWS connections this outpost assumes itself, comma separated. See below. |
VpcId, SubnetIds | Where the instance runs. | |
AssignPublicIp | false | true for public subnets without a NAT gateway. |
HttpsProxy, NoProxy | empty | An HTTP proxy for the outpost, Docker's pulls and the ECS agent, and the hosts that skip it. |
Architecture | arm64 | Or x86_64. |
InstanceType | t4g.xlarge or t3.xlarge | 4 vCPUs and 16 GiB. |
RootVolumeGiB | 100 | For the analyzer images and the running scans. |
ExistingClusterName | empty | Run in this cluster instead of creating one. |
Pick the instance type with Plan an outpost open:
| Your connections send | Instance type | Why |
|---|---|---|
| AWS posture checks, discovery, single platform image scans | The default, t4g.xlarge or t3.xlarge | 16 GiB holds one single platform image scan at a time, and 4 vCPUs two scans at once. It refuses repository scans with every category on and multi platform image scans. |
| Repository scans | 64 GiB, such as r6g.2xlarge on arm64 | A repository scan with every category on peaks at 30 GiB by its limits, more than any 32 GiB instance offers at a Memory overcommit of 1.0. A higher overcommit can fit one on a smaller instance, with the trade Plan an outpost describes. |
Scan concurrency and Memory overcommit are the outpost's, set in the drawer and changed in its pane like any other outpost's: the stack follows them while MaxJobs is empty. Scan concurrency caps the scans; the memory and the CPUs decide how many really run. The outpost runs at most one scan per 2 vCPUs, so a 2 vCPU instance such as r7g.large runs one scan at a time, posture checks included, however much memory is left. Raising Scan concurrency on the default instance changes nothing.
AWS accounts the outpost assumes
An AWS connection normally trusts Dwaar's account. If you would rather no outside account appear in your trust policies, let the outpost assume the role with its own identity: the stack's task role.
-
Deploy, or update, the stack with the connection's role in
AssumeRoleArns. The task role may then assume those roles and nothing else. -
Read the task role's ARN from the stack's outputs, or from AWS identity in the outpost's pane once it is online:
aws cloudformation describe-stacks --stack-name dwaar-outpost \--query "Stacks[0].Outputs[?OutputKey=='TaskRoleArn'].OutputValue" --output text -
Name that ARN as the trusted principal in the connection role's trust policy, with your external id. Once the connection is bound to this outpost, the connect form's setup guide fills that ARN into the trust policy for you. Bind connections shows the connect form side.
Cost
You pay AWS, not Dwaar, for what the stack creates: the instance and its disk, one Secrets Manager secret, and the logs. The instance runs all the time, busy or idle, so it is the bulk of the bill: size it for the work you will really send. Outside the stack, you also pay for the traffic your NAT gateway or proxy carries, starting with about 16 GB of analyzer images on the first pull and again when the catalogue changes.
Patching the instance
The stack picks the current ECS optimised Amazon Linux 2023 image when it creates the instance and leaves the running instance alone after that. Keeping it patched is yours. Its role allows Session Manager, so patch it in place with your usual Systems Manager routine. Replacing the instance instead loses the outpost's credential: see Replacing the instance.
Behind a TLS inspecting proxy
The stack has no parameter for your proxy's CA, so an outpost it creates cannot trust a proxy that inspects TLS. If your outbound traffic must go through one, run the outpost on an EC2 instance with systemd or Compose instead, enrolling it with --ca-file, or let the outpost's traffic bypass inspection.
Updating the outpost
To upgrade to 0.1.3, deploy again with the new Image. aws cloudformation deploy keeps the values you do not pass, including the token, which is not needed again:
aws cloudformation deploy --stack-name dwaar-outpost --template-file dwaar-outpost-ecs.yaml --capabilities CAPABILITY_IAM \
--parameter-overrides Image=ghcr.io/dwaarai/outpost:0.1.3
Use the template the drawer offers today, not the one you downloaded for 0.1.0. In the 0.1.0 template MaxJobs defaults to 2, and a stack created from it keeps that value through the update, which 0.1.1 and later treat as a host override. If the pane shows Scan concurrency as set on the host after the update, clear MaxJobs, so the stack follows the console: with Update stack in the AWS console, or by adding MaxJobs= with nothing after it to --parameter-overrides in the command above.
The new task reuses the credential on the instance. ECS gives a container at most 120 seconds to stop: the old task shows as Stopping, and scans still running get 100 of those seconds. Any that do not finish are queued again and run on the new task.
Replacing the instance
The outpost's credential lives on the instance's disk. A new instance, from a new AMI or after the old one was terminated, starts without it and cannot enroll with the spent token. When that happens, revoke the outpost in Dwaar, create a new token, and deploy again with EnrollmentToken set to it, within the hour. Keep OutpostName as it was, so the new outpost has the old name. The same works on the same instance after you revoke the outpost: its credential is refused, so it enrolls with the new token under the same name.
Removing it
Revoke the outpost in Dwaar first, so its credential stops working, then delete the stack:
aws cloudformation delete-stack --stack-name dwaar-outpost
The instance, the roles, the security group, the secret and the log group go with the stack.
What you should see
The stack's outputs hold two ready commands: TailLogs follows the outpost's logs, and Status runs outpost status inside the task. In Dwaar, the outpost shows as Online under Scan Center, then Outposts, with AWS ECS under Deployed with and the stack's task role under AWS identity. An outpost older than 0.1.1 shows AWS identity as "Not reported by this version": upgrade it as above.
Try this next
Connect one AWS account with Role assumed by set to An outpost, using this stack's task role in the trust policy. Run Test connection. When it passes, open the role's trust policy again and notice that no account but yours is in it.