AWS ECS is a fully managed container service that allows organizations to easily deploy, manage, and scale containerized applications. AWS ECS optimally distributes the container instances across available EC2 resources or via Fargate – a serverless deployment option to scale containerized workloads. The process of deploying, managing, and scaling containerized applications via AWS ECS is automated, in compliance with the security policies set by the customer and enforced by the cloud vendor.
Despite out-of-box security configuration delivered by AWS, vulnerabilities and / or misconfigurations may allow attackers to compromise container applications. This can potentially allow attackers to gain access to other cloud systems, exfiltrate critical data, execute malware such as ransomware, or compromise user accounts.
For more information on securing and investigating AWS ECS, read our playbook for best practices.
In order to mitigate these security risks, below you’ll find 9 best practices to secure AWS ECS containerized applications:
1. Understand the AWS Shared Responsibility Model:
The first step toward security in the cloud is to carefully understand that security and compliance is a shared responsibility of AWS and its customers. To summarize, customers are responsible for everything “IN” the AWS cloud, whereas AWS is responsible for security “OF” the cloud. For example, customers are responsible for maintaining security of their own data, operating systems, network and firewall configurations, identity and access management, and more. On the other hand, AWS is responsible for securing the overall hardware and global infrastructure (detailed guidelines from AWS on the shared responsibility model).
2. Enforce a Zero-Trust Identity and Access Management (IAM) Policy
Zero-Trust security design follows the principle of: Never Trust, Always Verify. The concept assumes no default trust for any user. It enforces granular rules that define the scope of accessing data and workloads in the cloud, only allowing them to perform actions authorized within the defined organizational policies. The following recommendations can help improve IAM rule enforcement for AWS ECS workloads:
3. Ensure End-to-End Encryption for Secure Network Channels
Consider end-to-end encryption of mission-critical workloads running in AWS ECS environments. Encryption prevents unauthorized entities from being able to view or modify confidential information in transit. Some things to consider include:
4. Inject Secrets into Containers at Runtime
Follow a zero-trust security policy in managing the Secrets definition parameters for AWS containers. Secrets include login credentials, certificates and API keys used by applications and services to access other system components. The following guidelines can be used in managing and using Secrets parameters:
5. Regulatory Compliance as the Bare Minimum
Follow the guidelines of the applicable security regulations in your country and industry, but treat them as a bare minimum and not an end-goal of your ECS security plan. AWS helps deploy compliance-focused baseline environments especially focused on the following guidelines across most of the popular regulations such as HIPAA, PCI-DSS and GDPR. Beyond this, it's important to consider the following (some already mentioned):
6. Gather the Right Data
Configure your container environments to communicate relevant security data and log data to the built-in AWS monitoring tools such as CloudWatch and CloudTrail. These tools can be used to collect data insights at the hardware, service and cluster level. However, this data alone may not suffice for an in-depth investigation of ECS containers.
In this context, the most useful data are the system logs and files from within the container, the containers running processes and active network connections, the container host system and container runtime logs (if accessible), the container host memory (if accessible) and the AWS VPC flow logs for the VPC the container is attached to. You should be able to collect, correlate and enrich these data sources to effectively investigate a container potentially involved in an incident and then collect this same data from any other containers which are likely also affected or connected to any containers operating in a suspicious manner (e.g., they are part of the same application like a web server and database server). However, this data is not natively available through the built-in tools. In order to gain more visibility into ECS containers, third-party incident and threat intelligence capabilities prove vital to discover, monitor and secure all container assets.
7. Best-Practices for AWS Fargate
AWS Fargate is a serverless service that provides the option of fully managed and abstracted infrastructure for containerized applications managed using AWS ECS. The AWS Fargate service performs tasks such as provisioning, management and security of the underlying container infrastructure while users simply specify the resource requirements for their containers. The following security guidelines should be followed when you leverage the AWS Fargate service:
8. Construct Secure Container Images
Container images consist of multiple layers, each defining the configurations, dependencies and libraries required to run a containerized application. Security of container images should be seen as your first line of defense against cyber-attacks or infringements facing your containerized applications. Constructing secure container images is critical to enforce container bounds and prevent adversaries from accessing the Host OS and Kernel. The following ECS container image security best practices should be considered:
9. Ensure Incident Readiness for Containers
It's often said that incidents are ‘when, not if’ so preparing to investigate and respond is key, regardless of how robust your container security is. When investigating an environment which utilizes containers, data collection needs to happen quickly before automatic cluster scaling destroys valuable evidence. Additionally, you may have thousands of containers so the collection, processing, and enrichment of container data needs to be automated. Some of the key things to consider are:
In summary, it’s important to understand that the nature of AWS ECS as a managed service and the potential scale of an app running across multiple containerized environments makes it challenging to effectively capture data and investigate incidents. In addition to following the industry-proven AWS ECS best practices discussed in this blog, a primary focus toward automation technologies is key to achieving a secure, high performance and defendable container environment.
For more information on securing and investigating AWS ECS, read our playbook for best practices.