AWS EKS EC2 ASG

AWS EKS EC2 ASG

AWS-EKS-ASG PLATFORM SETUP

Installation

The AWS EKS EC2 ASG Auto scaling Workflow is open source on GitHub, and you can install it by cloning the repository.

When you’re done cloning it, follow the instructions below to build and deploy your Workflow.

Create Secret from Settings

  • Back in your CTO.ai dashboard, create your secrets by selecting Settings and Secrets.

Secrets are encrypted environment variables that CTO.ai utilizes within your workflow to build and run your application and deployments.

You will create four secrets:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_ACCOUNT_NUMBER
  • GITHUB_TOKEN
  • To create your AWS SECRET KEY AND ACCESS KEY . Log into your AWS Account, select the Identity and Access Management (IAM) dashboard, create a new user, copy the Access Key ID and Secret access key and paste it in your secret dashboard on CTO.ai.
  • Your AWS ACCOUNT NUMBER can be gotten from your User ID on the top right corner in your AWS Console.

Generate GitHub Token

Generate your GITHUB_TOKEN from Github by going to Settings → Developer settings → Personal access tokens → Generate new token on your Github profile.

  • Back in your CTO.ai Secrets dashboard create your secret key/value pairs.

EKS EC2 ASG DEMO

Our EKS-EC2-ASG stack is a PaaS workflow with GitOps / ChatOps features that supports EKS on EC2, Aurora, SQS, Redis, and Autoscaling via CDK.

On our GitHub page, clone the workflow.sh repository. The workflow.sh repo contains the AWS EKS EC2 ASG and Auto scaling group stack that acts as your infrastructure for you to be able to deploy, manage and run your container services, resources, and sample applications.

Build Pipelines locally with the CTO.ai CLI

  • In your terminal, enter the ops build . command and select the sample-app-pipeline. This ops build . command will build your op for sharing, your Docker image from your Docker file, and the set of files located in the specified path you created in your source code.
  • When your image is built, it’s going to create an image ID, and successfully tag it in your CTO.ai console.

Run Pipelines locally with the CTO.ai CLI

Run your pipeline by entering ops run . in your terminal. The ops run . command will start the workflow you built from your team or registry.

  • select the sample-app-pipeline - build a release for deployment
  • It will start running your pipeline job

Run and Setup your Infrastructure

Back in your AWS EKS EC2 ASG workflow, build and set up your infrastructure using the ops run -b . command. This will provision your AWS-EKS EC2 ASG stacks using Cloud Formation.

  • select setup an environment

The process will build your Docker image and start loading up your EKS EC2 ASG Autoscaling stack.

  • Enter the name if your environment. You can use dev as the name of your environment. You can also use Prod or Stage, depending on what you want.
  • Enter the name of your application repo you created which is sample-app and hit enter
  • Enter the name of the GitHub branch you want to use
  • Your workflow will start deploying and creating your resources on AWS using CloudFormation
  • You can see the deployment process and how your AWS EC2 and Elastic Kubernetes Service workflow is been deployed

view changes on AWS CloudFormation

  • After deploying your AWS EC2 and Elastic Kubernets workflow, you can see your stack directly on AWS CloudFormation. In your CloudFormation Stack you can see your AWS resources created:
  • Dev-AWS-EKS-ASG-Provider
  • AWS-EKS-EC2-ASG Resource
  • Dev-AWS-EKS-EC2-ASG
  • Sample-App-AWS-EKS
  • CDKToolkit
  • Dev-Sample-App-AWS-EKS-EC2-ASG
  • If you click on the stack name you will see your Stack info, Events, Resources, Outputs, Paramaters, Template, and Change sets

View EC2 instances on AWS

Back in your AWS console, you can see your EC2 instances running. The AWS EC2 Workflow creates four instances for you:

  • dev-aws-eks-ec2-asg-bastion
  • dev-aws-eks-ec2-asg/dev-aws-eks-ec2-asg-asg
  • dev-aws-eks-ec2-asg/dev-aws-eks-ec2-asg-asg
  • dev-aws-eks-ec2-asg/dev-aws-eks-ec2-asg-asg
  • When you click on the instance, you will see your Details, Security groups, Networking, Storage, Status checks, Monitoring and Tags resources

View Elastic Kubernetes Service Cluster

Next, in your EKS console you will see that your EKS cluster is automatically provisioned.

  • Inside your Cluster, you can see your kubernetes version, Status, Resourcs, Compute, Networking, Add-ons, Authentication, Logging, Update history and Tags.

View Auto Scaling groups

In your EC2 dashboard, you can see your auto scaling groups instances and status.

AWS Auto Scaling schedules the scaling actions that proactively increases and decreases capacity to match the load forecast. At the scheduled time, AWS Auto Scaling updates the minimum capacity with the value specified by the scheduled scaling action