Amazon ECS
This guide shows you how to deploy Prisma Cloud Defenders in an ECS cluster.
Defender protects your containerized environment according to the policies you set in Prisma Cloud Console.
It runs as a service in your ECS cluster.
The parameters of the service are described in a task definition, and the task definition is written in JSON format.
To automatically deploy an instance of Defender on each node in your cluster, you’ll run the Defender task as a daemon service.
This guide assumes you know very little about AWS ECS.
As such, it is extremely prescriptive, and includes step for building your cluster.
If you are already familiar with AWS ECS and do not need assistance navigating the interface, simply read the section synopsis, which summarizes all key configurations.
Cluster context
Prisma Cloud can segment your environment by cluster.
For example, you might have three clusters: test, staging, and production.
The cluster pivot in Prisma Cloud lets you inspect resources and administer security policy on a per-cluster basis.

Cluster awareness across the product
Radar lets you explore your environment cluster-by-cluster. Various scan reports and audits include the relevant cluster name to provide environment context.
You can also create stored filters (also known as collections) based on cluster names.
Finally, you can scope policy by cluster.
Vulnerability and compliance rules for container images and hosts, runtime rules for container images, and trusted images rules can all be scoped by cluster name.
Determine cluster name
Defenders in each DaemonSet are responsible for reporting which resources belong to which cluster.
When deploying a Defender DaemonSet, Prisma Cloud tries to determine the cluster name through introspection.
First, it tries to retrieve the cluster name from the cloud provider.
As a fallback, it tries to retrieve the name from the kubeconfig file (the cluster name will be taked from the server field).
Finally, you can override these mechanisms by manually specifying a cluster name when deploying your Defender DaemonSet.
Both the Prisma Cloud UI and twistcli tool accept an option for manually specifying a cluster name.
Let Prisma Cloud automatically detect the name for provider-managed clusters.
Manually specify names for self-managed clusters, such as those built with kops.
There are some things to consider when manually naming clusters:
- If you specify the same name for two or more clusters, they’re treated as a single cluster.
- For GCP, if you have clusters with the same name in different projects, they’re treated as a single cluster. Consider manually specifying a different name for each cluster.
- Manually specifying names isn’t supported inManage > Defenders > Manage > DaemonSet. This page lets you deploy and manage DaemonSets directly from the Prisma Cloud UI. For this deployment flow, cluster names are retrieved from the cloud provider or the supplied kubeconfig only.
If you wish to change the cluster name determined by Prisma Cloud Compute, or the name you manually set for the cluster, you must redeploy the Defenders DaemonSet and specify the new name. Notice that after changing the name, historical records for audits and incidents, will keep the cluster name from their creation time. The new cluster name will only apply for future records. Also, if you already created collections using the old cluster name, these need to be manually updated with the new name.
Create a cluster
Create an empty cluster named pc-ecs-cluster.
Later, you will create launch configurations and auto-scaling groups to start EC2 instances in the cluster.
- Log into the AWS Management Console.
- Go toServices > Containers > Elastic Container Service.
- ClickCreate Cluster.
- SelectNetworking only, then clickNext Step.
- Enter a cluster name, such aspc-ecs-cluster.
- ClickCreate.
Deploy Defender
Create worker nodes in your ECS cluster, create a task definition for the Prisma Cloud Defender, and then create a service of type Daemon to deploy Defender to every node in the cluster.
If you already have worker nodes in your cluster, skip directly to creating the Defender task definition.
Create a launch configuration for worker nodes
Create a launch configuration named pc-worker-node that:
- Runs the Amazon ECS-Optimized Amazon Linux 2 AMI.
- Uses the ecsInstanceRole IAM role.
- Runs a user data script that joins the pc-ecs-cluster and runs the commands required to install Defender.
- Go toServices > Compute > EC2.
- In the left menu, clickAuto Scaling > Launch Configurations.
- ClickCreate Launch Configuration
- InName, enter a name for your launch configuration, such aspc-worker-node.
- In Amazon machine image, selectAmazon ECS-Optimized Amazon Linux 2 AMI.You can get a complete list of per-region Amazon ECS-optimized AMIs from here.
- Choose an instance type, such ast2.medium.
- UnderAdditional configuration:
- InIAM instance profile, selectecsInstanceRole.
- UnderUser data, selectText, and paste the following code snippet:#!/bin/bash echo ECS_CLUSTER=pc-ecs-cluster >> /etc/ecs/ecs.configWhere:
- ECS_CLUSTER must match your cluster name. If you’ve named your cluster something other than pc_ecs_cluster, then modify your user data script accordingly.
(Optional) InIP Address Type, selectAssign a public IP address to every instance.With this option, you can easily SSH to this instance to troubleshoot issues. - UnderSecurity groups:
- SelectSelect an existing security group.
- Selectpc-security-group.
- UnderKey pair (login), select an existing key pair, or create a new key pair so that you can access your instances.
- ClickCreate launch configuration.
Create an auto scaling group for worker nodes
Launch two worker nodes into your cluster.
- Go toServices > Compute > EC2.
- In the left menu, clickAuto Scaling > Auto Scaling Groups.
- ClickCreate an Auto Scaling group.
- InChoose launch template or configuration:
- InAuto Scaling group Name, enterpc-worker-autoscaling.
- InLaunch template, clickSwitch to launch configuration.
- Selectpc-worker-node.
- ClickNext.
- UnderConfigure settings:
- InVPC, select your default VPC.
- InSubnet, select a public subnet, such as 172.31.0.0/20.
- ClickNext.
- InConfigure advanced options, accept the defaults, and clickNext.
- InConfigure group size and scaling policies:
- SetDesired capacityto2.
- LeaveMinimum capacityat1.
- SetMaximum capacityto2.
- ClickSkip to review.
- Review the configuration and clickCreate Auto Scaling Group.After the auto scaling group spins up (it will take some time), validate that your cluster has three container instances.
- Go toServices > Containers > Elastic Container Service.
- The count forContainer instancesin your cluster should now be a total of two.
Create a Prisma Cloud Defender task definition
Generate a task definition for Defender in Prisma Cloud Console.
- Log into Prisma Cloud Compute Console.
- Go toManage > Defenders > Deploy > Defenders.
- InDeployment method, selectOrchestrator.
- For orchestrator type, selectECS.
- InSpecify a cluster name, leave the field blank.Console will automatically retrieve the cluster name from AWS. Only enter a value if you want to override the cluster name assigned in AWS.
- InSpecify ECS task name, leave the field blank.By default, the task name ispc-defender.
- ClickDownloadto download the task definition.
- Log into AWS.
- Go toServices > Containers > Elastic Container Service.
- In the left menu, clickTask Definitions.
- ClickCreate new Task Definition.
- InStep 1: Select launch type compatibility, selectEC2, then clickNext step.
- InStep 2: Configure task and container definitions, scroll to the bottom of the page and clickConfigure via JSON.
- Delete the contents of the window, and replace it with the Prisma Cloud Console task definition you just generated.
- ClickSave.
- (Optional) Change the name of the task definition before creating it. The default name ispc-defender.
- ClickCreate.
Start the Prisma Cloud Defender service
Create the Defender service using the task definition.
With Daemon scheduling, ECS schedules one Defender per node.
- Go toServices > Containers > Elastic Container Service.
- In the left menu, clickClusters.
- Click on your cluster.
- In theServicestab, clickCreate.
- InStep 1: Configure service:
- ForLaunch type, selectEC2.
- ForTask Definition, selectpc-defender.
- InService Name, enterpc-defender.
- InService Type, selectDaemon.
- ClickNext Step.
- InStep 2: Configure network, accept the defaults, and clickNext step.
- InStep 3: Set Auto Scaling, accept the defaults, and clickNext step.
- InStep 4: Review, clickCreate Service.
- ClickView Service.
- Verify that you have Defenders running on each node in your ECS cluster.
- Go to your Prisma Cloud Console and view the list of Defenders inManage > Defenders > Manage. There should be two new Defenders that have been connected for a few minutes, one for each ECS instance in the cluster.
Recommended For You
Recommended Videos
Recommended videos not found.