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
1 change: 1 addition & 0 deletions day-14/simple-python-app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ def hello():
if __name__ == '__main__':
app.run()


8 changes: 5 additions & 3 deletions day-14/simple-python-app/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ phases:
pre_build:
commands:
- echo "Installing dependencies..."
- pip install -r day-13/simple-python-app/requirements.txt
- pip install -r day-14/simple-python-app/requirements.txt
build:
commands:
- echo "Running tests..."
- cd day-13/simple-python-app/
- cd day-14/simple-python-app/
- echo "Building Docker image..."
- echo "$DOCKER_REGISTRY_PASSWORD" | docker login -u "$DOCKER_REGISTRY_USERNAME" --password-stdin "$DOCKER_REGISTRY_URL"
- docker build -t "$DOCKER_REGISTRY_URL/$DOCKER_REGISTRY_USERNAME/simple-python-flask-app:latest" .
Expand All @@ -26,6 +26,8 @@ phases:
- echo "Build completed successfully!"
artifacts:
files:
- ../../appspec.yml
- ../../scripts/**/*
- '**/*'
base-directory: ../simple-python-app
base-directory: .

14 changes: 5 additions & 9 deletions day-24/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@ resource "aws_security_group" "webSg" {
}

resource "aws_s3_bucket" "example" {
bucket = "abhisheksterraform2023project"
bucket = "dineshudaysterraform2025project"
}


resource "aws_instance" "webserver1" {
ami = "ami-0261755bbcb8c4a84"
ami = "ami-0360c520857e3138f"
instance_type = "t2.micro"
vpc_security_group_ids = [aws_security_group.webSg.id]
subnet_id = aws_subnet.sub1.id
user_data = base64encode(file("userdata.sh"))
user_data_base64 = base64encode(file("userdata.sh"))
}

resource "aws_instance" "webserver2" {
ami = "ami-0261755bbcb8c4a84"
ami = "ami-0360c520857e3138f"
instance_type = "t2.micro"
vpc_security_group_ids = [aws_security_group.webSg.id]
subnet_id = aws_subnet.sub2.id
user_data = base64encode(file("userdata1.sh"))
user_data_base64 = base64encode(file("userdata1.sh"))
}

#create alb
Expand Down Expand Up @@ -138,8 +138,4 @@ resource "aws_lb_listener" "listener" {
target_group_arn = aws_lb_target_group.tg.arn
type = "forward"
}
}

output "loadbalancerdns" {
value = aws_lb.myalb.dns_name
}
4 changes: 4 additions & 0 deletions day-24/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "loadbalancerdns" {
description = "DNS of Load Balancer"
value = aws_lb.myalb.dns_name
}
2 changes: 1 addition & 1 deletion day-24/provider.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.11.0"
version = "6.18.0"
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions scripts/start_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
set -e

# Pull the Docker image from Docker Hub
docker pull abhishekf5/simple-python-flask-app
docker pull dineshuday/simple-python-flask-app

# Run the Docker image as a container
docker run -d -p 5000:5000 abhishekf5/simple-python-flask-app
docker run -d -p 5000:5000 dineshuday/simple-python-flask-app