Coder Social home page Coder Social logo

appdynamics-terraform-ecs-fargate's Introduction

AppDynamics: ECS Fargate instrumentation using Terraform

Amazon Elastic Container Service (ECS) is a scalable container management service that makes it easy to run, stop, and manage Docker containers on Amazon EC2 clusters.

This project demonstrates how AppDynamics agents can be embedded into an existing ECS/Fargate setup using Terraform.

The primary considerations that went into the design of this project are:

  • Customers' existing container images and/or the image build process should be unaltered.
  • The deployment process must remain immutable.
  • Idempotency - customers should get the same instrumentation result even if the terraform config is applied multiple times.
  • AppDynamics access key must be stored and accessed from AWS secret manager, not as plaintext.

In addition, we leveraged on AWS CloudFormation's DependsOn attribute to:

  • Dynamically acquire the AppDynamics agent image from DockerHub. You may copy the image to your prefered registry.
  • Copy the content of the agent image into an ephemeral volume, then
  • Mount the shared volume into the main application's container at runtime.

Resources

This demo creates the following AWS resources:

  • VPC
  • One public and one private subnet per AZ
  • Routing tables for the subnets
  • Internet Gateway for public subnets
  • NAT gateways with attached Elastic IPs for the private subnet
  • Security groups - that allows access to the specified container port
  • An Application Load Balancer (ALB) - with listeners for port 80
  • An ECS cluster with a service - including auto-scaling policies for CPU and memory usage
    • Task definition to run docker containers - an init container for AppDynamics and the main container application
    • IAM execution role
  • Secrets - Creates secrets in Secret Manager

aws (Source: https://aws.amazon.com/de/blogs/compute/task-networking-in-aws-fargate/)

AppDynamics Specific Changes

  • The main logic is in the template/app.json.tpl file. Please review the DependsOn section and the AppDynamics environment variables.
  • Create AppDyamics secret in secrets.auto.tfvars Remove .example from the file name.
  • Populate appdynamics.auto.tfvars with your controller credentials and the agent's container registry.

Run it

First, you will need to set up the Terraform provider to talk to your AWS account. Please refer to main.tf

provider "aws" {
  access_key = var.aws-access-key
  secret_key = var.aws-secret-key
  region =     var.aws-region
  version    = "~> 2.0"
}

You can also leave out access_key and secret_key; then Terraform will use the profile values stored in your .aws/config.

Next, execute the following commands:

Initialise Terraform

$ terraform init

View Proposed execution plan

$ terraform plan

Executes the Terraform run

$ terraform apply

Delete all

$ terraform destroy

appdynamics-terraform-ecs-fargate's People

Contributors

iogbole avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

appdynamics-terraform-ecs-fargate's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.