From 44f087991c3928cd79c5c3690811bfb96ab05403 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Wed, 31 Jan 2024 23:53:41 -0500 Subject: [PATCH] ECS documentation --- .../integrations/platforms/ecs-with-agent.mdx | 90 +++++++++++++++++++ docs/mint.json | 3 +- 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 docs/integrations/platforms/ecs-with-agent.mdx diff --git a/docs/integrations/platforms/ecs-with-agent.mdx b/docs/integrations/platforms/ecs-with-agent.mdx new file mode 100644 index 000000000..cfe5eff52 --- /dev/null +++ b/docs/integrations/platforms/ecs-with-agent.mdx @@ -0,0 +1,90 @@ +--- +title: 'Amazon ECS' +description: "How to deliver secrets to Amazon Elastic Container Service" +--- + +![title](../../images/k8-diagram.png) + +This guide will go over the steps needed to configure an Amazon Elastic Container Service (ECS) task definition to access secrets stored in Infisical. + +At a high level, the steps involve setting up an ECS task with a Infisical Agent sidecar container. This container uses Universal Authentication to communicate with the target Infisical instance for fetching secrets. +Once the secrets/access tokens are retrieved, they are then stored in a shared Amazon Elastic File System (EFS) volume. This volume is then made accessible to your application container and all of its replicas. + +This guide will focus on integrating Infisical Cloud with Amazon ECS on AWS Fargate and Amazon EFS. +However, the principles and steps can be adapted for use with any instance of Infisical (on premise or cloud) and different ECS configurations, such as Amazon ECS on EC2 instances. + +## Prerequisites +This guide requires the following prerequisites: +- Infisical instance configured and running +- Git installed +- Terraform v1.0 or later installed +- Access to AWS credentials + +## Clone guide assets repository +To help you follow along with ease, please clone the guide assets from this [Github repository](https://github.com/Infisical/infisical-guides.git). +This repository contains assets for all Infisical guides. The content for this guide can be within a sub directory. +Specifically, change your working directory to `aws-ecs-with-agent`. + +## Configure AWS credentials +Because we'll be creating AWS recourses through Terraform, you will need to obtain a set of AWS Access Key and Secret Key. +Once you generated these credentials, export them to your terminal. + +1. Export the AWS Access Key ID: + + ```bash + export AWS_ACCESS_KEY_ID= + ``` + +2. Export the AWS Secret Access Key: + + ```bash + export AWS_SECRET_ACCESS_KEY= + ``` + +3. Export the AWS Session Token: + + ```bash + export AWS_SESSION_TOKEN= + ``` + +## Set up infrastructure + +Before we can deploy a sample service on Amazon ECS to demonstrate how you deliver secrets from Infisical, you must first provision baseline infrastructure components. +The following resources need to be created: +- AWS ECS Cluster with Fargate as launch type +- EFS volume +- Networking resources + +Instead of creating these resources one by one, we'll use the Terraform template in the guide folder to provision all resources at once. + +1. Change directory to `terraform` +```sh +cd terraform +``` + +2. Initialize Terraform +``` +terraform init +``` + +3. Preview resources that will be created +``` +terraform plan +``` + +4. Trigger resource creation +``` +terraform apply +``` + +## Configure Authentication with Infisical +In order to communicate with Infisical from our ECS application, we'll need to first authenticate with Infisical. +There are a number of methods to authenticate with Infisical; however, in this guide we'll be using Universal Auth to authenticate. + +Follow the documentation to here to configure and generate a client id and client secret with Universal auth here. +Make sure to save these credentials somewhere handy because we'll need them soon. + +## Setup sample application + +** diagram ** + diff --git a/docs/mint.json b/docs/mint.json index 9e3701519..b723b5c9e 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -234,7 +234,8 @@ }, "integrations/platforms/kubernetes", "integrations/frameworks/terraform", - "integrations/platforms/ansible" + "integrations/platforms/ansible", + "integrations/platforms/ecs-with-agent" ] }, {