Giter Club home page Giter Club logo

terraform-aws's Introduction

EKS and RDS Creation in AWS using Terraform

Overview:

This repo is having Terraform script that automates the creation of an Amazon Elastic Kubernetes Service (EKS) cluster and RDS instance on AWS. The script covers the following key components:

Project1-Employee_portal-Page-1

  1. AWS Configuration in Terraform:

    • Ensure you have an AWS account and have created an IAM user with administrator permissions.
    • Generate the Access Key ID and Secret Access Key for this IAM user.
  2. Jenkins Integration with AWS:

    • Add the IAM user's Access Key ID and Secret Access Key as Jenkins credentials.
    • In the Jenkinsfile, set these credentials as environment variables.

    Example Jenkinsfile snippet:

    pipeline {
     agent any 
         environment {
             AWS_ACCESS_KEY_ID=credentials('aws_access_key')
             AWS_SECRET_ACCESS_KEY=credentials('aws_access_key_value')
         }
    }
  3. Terraform State Management:

    • The Terraform state file is stored in an S3 bucket for better collaboration and consistency across your team.
    • Ensure that you have configured the AWS provider with the necessary credentials.

    Example Terraform Configuration:

       terraform {
       backend "s3" {
         bucket = "terraform-statefile-s3-aws"
         key    = "state/eks-cluster.tfstate"
         region = "us-east-2"
       }
     }
  4. EKS cluster creation

    • EKS Cluster:
      • VPC and 2 public subnets are created for the EKS cluster.
      • IAM roles are created and attached to the the AmazonEKSClusterPolicy.
      • The EKS cluster is created utilizing the specified IAM roles and VPC.
    • Node Group:
      • IAM roles with AmazonEKSWorkerNodePolicy and AmazonEKS_CNI_Policy are created.
      • EKS node group is configured to utilize the created IAM roles. image
  5. RDS Instance creation

    • Creating an AWS RDS instance with Terraform involves setting up a VPC, two public subnets in different zones, and a database subnet group.
    • The RDS instance, specifically for MySQL, is configured using Terraform, defining details like instance ID, username, and password.
    • Additionally, a security group is established to permit all required incoming connections, ensuring accessibility to the RDS instance. image

Usage:

  1. Setup Terraform:
    • Install Terraform locally
  2. Terraform steps :
    • Added all terraform commands in jenkins file image

    • Terraform init -- This initiates the download of required providers.

    • Terraform plan -- This command reveals the anticipated resources that will be created.

    • terraform apply -- This command parameterized within the pipeline, can be chosen to be executed or skipped, It results in the creation of resources in AWS. image

    • Terraform destroy -- This command, which can be customized in the pipeline, lets you decide whether to run it or not. If executed, it starts cleaning up resources.

terraform-aws's People

Contributors

selvanayaki678 avatar

Stargazers

 avatar

Watchers

 avatar

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.