AWS Logo
Menu

Extend Amazon ECS across two Outposts racks

Explore integrating Amazon ECS with AWS Outposts using this guide. Follow this script step-by-step for a seamless setup.

Abeer Naffa
Amazon Employee
Published Aug 5, 2024
Authors: Abeer Naffa, Sr SA-Hybrid Cloud and Davi Garcia Sr SA-Migration Specialist
Last week, Davi and I were deeply engaged in testing and deploying an Amazon ECS cluster across multiple logical AWS Outposts rack. This effort supported a use case that required tasks to be distributed across two separate Outposts racks, with no communication necessary between them. Each task was designed to operate independently to meet specific operational demands. Recognizing the detailed configuration required for such a setup, we've prepared a comprehensive script to facilitate the process. This script is designed to guide you step-by-step in creating a robust ECS environment on AWS Outposts. Each step is clearly explained to ensure ease of implementation. This configuration harnesses the scalability and power of AWS, extending it into your on-premises infrastructure, thus providing a seamless hybrid cloud experience that meets the demands of diverse computing environments.

Prerequisites:

To effectively extend ECS to multiple logical Outposts setup, several key prerequisites must be met:
  • Two logical Outposts: Ensure that two logical AWS Outposts are properly installed and configured in your on-premises environment.
  • Adequate access rights: Necessary permissions should be in place for setting up and managing all configurations and security settings in this guide.
  • Ability to run script-based commands: all configurations must be run as scripts rather than directly through the CLI. It's recommended to run the entire walkthrough as a single script in environment capable of running .sh files, provided it has the necessary permissions for successful execution. Note: This script has been tested on macOS and can be adjusted to suit different environments or requirements.
Disclaimer: Before executing the end-to-end script, please ensure that you carefully review and validate that the script aligns with your organization's security and corporate policies.

Step-by-Step walkthrough:

This walkthrough guide you through setting up and configuring ECS on two Outposts, enabling a scalable and resilient environment.
Architecture Image!
Extending ECS across two logical Outposts
Figure: Extending ECS across two logical Outposts
  • Parameters: begin by setting the necessary variables for your AWS Region, VPC, subnets, and Outposts configuration. This will establish the framework for all subsequent commands.
  • VPC and subnets Configuration: Create a VPC and multiple subnets for public and private access, ensuring they are linked to your Outpost for local processing capabilities.
  • Security and role configuration: Establish security groups for your ECS instances and define IAM roles necessary for ECS operations.
  • Create the ECS cluster: Creating a resilient and scalable Amazon ECS cluster across multiple logical AWS Outposts involves several steps.
  • Create an EC2 Launch Template: The launch template defines the configuration of EC2 instances that will run your ECS tasks. It includes specifications for the instance type, IAM roles, security groups, and user data that configures the instance to join your ECS cluster.
Please note that if your Outposts are configured differently or slotted in unique configurations, you will need separate launch templates for each. These individual launch templates should be specifically tailored and assigned to the auto scaling groups and capacity providers corresponding to the respective Outposts in the subsequent steps of your setup. This ensures that each Outpost is accurately provisioned with the correct settings and resources, aligning with its specific requirements.
  • Create Auto Scaling Groups: Configure Auto Scaling Groups (ASG) to automatically manage the scaling of your EC2 instances across different subnets on Outposts. This setup enhances high availability and fault tolerance.
  • Create Capacity providers(CPs): CPs are essential for linking your auto-scaling settings to the ECS cluster, enabling ECS to manage the scaling of tasks based on demand. As well as gives you the capability to choose where to deploy your tasks.
This step is crucial as it involves defining two capacity providers, one for each logical Outpost. Here, you will assign a weight to each capacity provider to determine their contribution to the overall task placement strategy. This configuration ensures that tasks are distributed according to the defined weights, optimizing resource utilization across both Outposts.
  • Sample task for testing: This task definition is structured to ensure optimal performance and reliability for NGINX running within our ECS cluster on AWS Outposts.
For testing purposes, we deployed the same tasks to both Outposts racks. However, you can tailor the deployment by assigning tasks separately to each Outpost, leveraging the appropriate subnet. This flexibility allows you to optimize resource usage and task distribution based on the specific needs and capabilities of each Outpost.

Conclusion

Leveraging ECS Capacity Providers to deploy workloads across multiple Availability Zones (AZs) on Outposts rack offers a robust solution for achieving high availability, scalability, and resilience in a hybrid cloud environment. This approach seamlessly integrates the operational flexibility of AWS with the specific needs of on-premises infrastructures, ensuring that applications run efficiently and reliably, even in complex deployment scenarios.
 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments