Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion k8s_files/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: pandacloud-container
image: 309395755719.dkr.ecr.us-east-1.amazonaws.com/amazon-prime:latest
image: 476114139197.dkr.ecr.us-east-1.amazonaws.com/amazon-prime:latest
ports:
- containerPort: 3000
...
3 changes: 2 additions & 1 deletion src/components/HomeTileData.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const abc = [
{
id: 0,
Title: "Avatar",
Title: "Avatarssssss",
Year: "2009",
rated: "PG-13",
released: "18 Dec 2009",
Expand Down Expand Up @@ -267,3 +267,4 @@ const abc = [
];

export default abc;

2 changes: 1 addition & 1 deletion src/components/Languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const abc = [
{ id: 6, name: "Marathi" },
{ id: 7, name: "Punjabi" },
{ id: 8, name: "Gujarati" },
{ id: 9, name: "Bengali" },
];

export default abc;

7 changes: 7 additions & 0 deletions terraform_code/ec2_server/daws-82s.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACDeYgM5pYsBsUtSW+qMpmwAj0WQbJOnUfeahDIHBdZMrgAAAKA6gF1tOoBd
bQAAAAtzc2gtZWQyNTUxOQAAACDeYgM5pYsBsUtSW+qMpmwAj0WQbJOnUfeahDIHBdZMrg
AAAED/+0YXnpzDUex5ZuzR9JoceYaJX9rqt6jbLZaeE/yOqd5iAzmliwGxS1Jb6oymbACP
RZBsk6dR95qEMgcF1kyuAAAAGkVBRCtza29kaXNoYWxhQFVTLVBGMlJWQ1pIAQID
-----END OPENSSH PRIVATE KEY-----
4 changes: 2 additions & 2 deletions terraform_code/ec2_server/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.67.0"
version = "4.67.0"
}
}
}
Expand Down Expand Up @@ -153,7 +153,7 @@ resource "aws_instance" "my-ec2" {
# ESTABLISHING SSH CONNECTION WITH EC2
connection {
type = "ssh"
private_key = file("./key.pem") # replace with your key-name
private_key = file("./amazon.pem") # replace with your key-name
user = "ubuntu"
host = self.public_ip
}
Expand Down
6 changes: 3 additions & 3 deletions terraform_code/ec2_server/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# DEFINE ALL YOUR VARIABLES HERE

instance_type = "t2.medium"
instance_type = "t2.large"
ami = "ami-0e86e20dae9224db8" # Ubuntu 24.04
key_name = "key" # Replace with your key-name without .pem extension
volume_size = 30
key_name = "amazon" # Replace with your key-name without .pem extension
volume_size = 25
region_name = "us-east-1"
server_name = "JENKINS-SERVER"

Expand Down
23 changes: 11 additions & 12 deletions terraform_code/eks_code/eks.tf
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "19.15.1"
version = "~> 20.0"

cluster_name = local.name
cluster_endpoint_public_access = true
cluster_name = local.name
cluster_version = "1.32"
create_node_security_group = false
create_cluster_security_group = false


cluster_addons = {
coredns = {
most_recent = true
}
kube-proxy = {
most_recent = true
}
vpc-cni = {
most_recent = true
}
coredns = {}
eks-pod-identity-agent = {}
kube-proxy = {}
vpc-cni = {}
metrics-server = {}
}

vpc_id = module.vpc.vpc_id
Expand Down
81 changes: 81 additions & 0 deletions terraform_code/eks_code/modules/eks/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
resource "aws_iam_role" "cluster" {
name = "${var.cluster_name}-cluster-role"

assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Action = "sts:AssumeRole"
Effect = "Allow"
Principal = {
Service = "eks.amazonaws.com"
}
}]
})
}

resource "aws_iam_role_policy_attachment" "cluster_policy" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
role = aws_iam_role.cluster.name
}

resource "aws_eks_cluster" "main" {
name = var.cluster_name
version = var.cluster_version
role_arn = aws_iam_role.cluster.arn

vpc_config {
subnet_ids = var.subnet_ids
}

depends_on = [
aws_iam_role_policy_attachment.cluster_policy
]
}

resource "aws_iam_role" "node" {
name = "${var.cluster_name}-node-role"

assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Action = "sts:AssumeRole"
Effect = "Allow"
Principal = {
Service = "ec2.amazonaws.com"
}
}]
})
}

resource "aws_iam_role_policy_attachment" "node_policy" {
for_each = toset([
"arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy",
"arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy",
"arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
])

policy_arn = each.value
role = aws_iam_role.node.name
}

resource "aws_eks_node_group" "main" {
for_each = var.node_groups

cluster_name = aws_eks_cluster.main.name
node_group_name = each.key
node_role_arn = aws_iam_role.node.arn
subnet_ids = var.subnet_ids

instance_types = each.value.instance_types
capacity_type = each.value.capacity_type

scaling_config {
desired_size = each.value.scaling_config.desired_size
max_size = each.value.scaling_config.max_size
min_size = each.value.scaling_config.min_size
}

depends_on = [
aws_iam_role_policy_attachment.node_policy
]
}
9 changes: 9 additions & 0 deletions terraform_code/eks_code/modules/eks/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
output "cluster_endpoint" {
description = "EKS cluster endpoint"
value = aws_eks_cluster.main.endpoint
}

output "cluster_name" {
description = "EKS cluster name"
value = aws_eks_cluster.main.name
}
32 changes: 32 additions & 0 deletions terraform_code/eks_code/modules/eks/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
variable "cluster_name" {
description = "Name of the EKS cluster"
type = string
}

variable "cluster_version" {
description = "Kubernetes version"
type = string
}

variable "vpc_id" {
description = "VPC ID"
type = string
}

variable "subnet_ids" {
description = "Subnet IDs"
type = list(string)
}

variable "node_groups" {
description = "EKS node group configuration"
type = map(object({
instance_types = list(string)
capacity_type = string
scaling_config = object({
desired_size = number
max_size = number
min_size = number
})
}))
}
40 changes: 40 additions & 0 deletions terraform_code/eks_code/modules/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}

backend "s3" {
bucket = "terraform-eks-state-locks-sai123"
key = "terraform.tfstate"
region = "us-east-1"
dynamodb_table = "terraform-eks-state-locks-sai123"
encrypt = true
}
}

provider "aws" {
region = var.region
}

module "vpc" {
source = "./modules/vpc"

vpc_cidr = var.vpc_cidr
availability_zones = var.availability_zones
private_subnet_cidrs = var.private_subnet_cidrs
public_subnet_cidrs = var.public_subnet_cidrs
cluster_name = var.cluster_name
}

module "eks" {
source = "./modules/eks"

cluster_name = var.cluster_name
cluster_version = var.cluster_version
vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnet_ids
node_groups = var.node_groups
}
14 changes: 14 additions & 0 deletions terraform_code/eks_code/modules/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
output "cluster_endpoint" {
description = "EKS cluster endpoint"
value = module.eks.cluster_endpoint
}

output "cluster_name" {
description = "EKS cluster name"
value = module.eks.cluster_name
}

output "vpc_id" {
description = "VPC ID"
value = module.vpc.vpc_id
}
65 changes: 65 additions & 0 deletions terraform_code/eks_code/modules/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
variable "region" {
description = "AWS region"
type = string
default = "us-east-1"
}

variable "vpc_cidr" {
description = "CIDR block for VPC"
type = string
default = "10.0.0.0/16"
}

variable "availability_zones" {
description = "Availability zones"
type = list(string)
default = ["us-east-1a", "us-east-1b", "us-east-1c"]
}

variable "private_subnet_cidrs" {
description = "CIDR blocks for private subnets"
type = list(string)
default = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
}

variable "public_subnet_cidrs" {
description = "CIDR blocks for public subnets"
type = list(string)
default = ["10.0.4.0/24", "10.0.5.0/24", "10.0.6.0/24"]
}

variable "cluster_name" {
description = "Name of the EKS cluster"
type = string
default = "my-eks-cluster"
}

variable "cluster_version" {
description = "Kubernetes version"
type = string
default = "1.30"
}

variable "node_groups" {
description = "EKS node group configuration"
type = map(object({
instance_types = list(string)
capacity_type = string
scaling_config = object({
desired_size = number
max_size = number
min_size = number
})
}))
default = {
general = {
instance_types = ["t3.medium"]
capacity_type = "SPOT"
scaling_config = {
desired_size = 2
max_size = 4
min_size = 1
}
}
}
}
Loading