CloudFormation ECS Fargate Advanced Template
  • Dark
    Light

CloudFormation ECS Fargate Advanced Template

  • Dark
    Light

Overview

This article details how to install the Matillion CDC Agent on Amazon ECS Fargate using a CloudFormation template.

These steps can only be taken after completing the preliminary steps found in AWS Installation: Templated Installations and assumes you have done so.

It is highly recommended you read the documentation and prerequisites before beginning this process. It is likely you will require input from your organisation's cloud administrator for access and permissions.

Created Resources

This template will create the following resources in your AWS account:

  • ECS Task Definition
  • ECS Fargate Cluster
  • S3 Bucket
  • CloudWatch Log Group
  • IAM Roles with permissions for the following:
    • Task Roles to your S3 bucket, ECS, EC2 and Secrets Manager (see "Task IAM Role" section)
    • Task Execution Roles to pull from ECR Public repositories (see "Task Execution IAM Role" section)

Visualization

image.png

Prerequisites

Edit the template

Users should inspect the template in a text editor and ensure the values are as-expected before proceeding. In particular, the PLATFORM_WEBSOCKET_ENDPOINT environment variable should be edited to match the expected endpoint and region. See Environment Variables for more information.

Resources

The advanced template assumes you have certain resources already set up in your AWS stack. You will also be required to provide details on these resources such as names, paths and ARNs.

  • Subnet(s) within a VPC with outbound access to the relevant data sources and destinations, as well as to ECR and to the Matillion CDC Websocket endpoint.
  • Security group controlling ingress/egress within the subnet(s).
  • Secrets Manager entries for your Platform Key and database passwords.

User Access

You as a user are also expected to have access to certain details and permissions:

  • Access to the Matillion Hub account and Matillion Data Loader.
  • CDC Agent Environment Variables (generated in Matillion Data Loader when creating a new agent).
  • Matillion Data Loader platform key (generated once per Matillion Data Loader account the first time you make an agent).
  • Access to AWS with the ability to create a stack on a billable account. You may require an administrator from your organisation to either give access or perform this process with you.

Create Agent Stack

You should have your Platform Key and Agent Identity Environment Variables ready before beginning this process. If you do not have these, please first consult the Creating Agents documentation.

Important

You will require permissions to create and manage resources in your AWS or Azure account. Please contact your administrator. Matillion's provided templates will not work if you have insufficient permissions.

Using the CloudFormation Template

  1. Download the ECS Fargate (CloudFormation) Basic template file:
  2. Log in to your AWS account and navigate to the CloudFormation service
  3. Choose Create Stack
  4. Select Template is ready
  5. Select Upload a template file and then Choose File
  6. Upload your template .json and click Next to move to the next screen

Specify stack details

Complete the form with the required details:

Field Description
Stack name An arbitrary name given to the created stack.
AgentID ID_AGENT attained during agent creation.
AssignPublicIp
  • ENABLED if your subnet running the CDC Agent uses Internet gateway for internet access.
  • DISABLED if your subnet uses a internet Gateway for routing traffic to internet.
Note: You can't deploy CDC agent on a subnet that doesn't have an Internet Gateway or a NAT Gateway/instance. Please refer to Subnets and Security Groups for more information.
BucketName An arbitrary name for the new target bucket for CDC output. Must be unique.
ClusterName An arbitrary name for the new ECS Fargate cluster that will be created from the template. This is where your agent is hosted. Must be unique.
ExecutionRoleName An arbitrary name for the new ECS Task Execution Role that will be created. Must be unique.
ImageUrl The path to the agent image on ECR. Do not edit this field.
LogGroupName An arbitrary name for for the CloudWatch Log Group that will be created for agent logging. Must be unique.
OrganizationID ID_ORGANIZATION attained during agent creation.
PlatformKeyName The name of the secret generated to hold your Platform Key. If you are following our recommended install, this will be agent-rsa.
PlatformWebsocketEndpoint This is a parameter that needs to have it’s value set. If you are following our recommended install of Agent, this will be platform-websocket-endpoint.
Region The name of the AWS Region you want to create these resources in. Note that it is usually best to keep all of your AWS resources in the same region when possible.
RoleName An arbitrary name for the new IAM Task Role used by the image to access AWS resources.
SecretARNs A comma-separated list of secret ARNs. The agent at least needs access to the Platform Key secret as well as leave as database password secrets. This field can be left as * to indicate access to all Secret ARNs.
SecurityGroups Select the Security group
ServiceName An arbitrary name for the new Elastic Container Service to run tasks under. Must be unique.
SubnetIDs The Subnet ID for Subnet your chosen subnet.
TaskDefinitionName A unique, arbitrary name for your agent tasks.

Next Steps:

  1. When your details are entered, click Next.
  2. Configure Stack Options: No action is required on this page. Click Next.
  3. Review: Select Acknowledge the template has changed and click Create.

When your stack has been fully created (will take some time) you can return to Matillion CDC and view the Agents list. Your new agent should appear on the list and have the "Connected" status if all has gone well. If not, please consult the Troubleshooting documentation.

If you are creating a Pipeline and have completed this step, consult the CDC Pipelines documentation to review the process and find your next steps.

Downloads

This article covers the advanced template installation. The template itself can be downloaded here:

And an accompanying parameter file for those installing via CLI: