Skip to content

Commit

Permalink
updated main2.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
peytontolbert committed Mar 5, 2024
1 parent 1c3f548 commit f015808
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion scripts/Dockerfile_qwen
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ RUN pip install --no-cache-dir tensorrt_llm -U --pre --extra-index-url https://p
COPY . /qwenvl
WORKDIR /qwenvl
# Expose the port the app runs on
EXPOSE 8000
EXPOSE 80
# Command to run the application
CMD ["python3.10", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]
44 changes: 28 additions & 16 deletions scripts/main2.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
provider "aws" {
region = "REGION"
region = "us-east-1"
}
variable "create_new_mount_target" {
description = "Whether to create new EFS mount targets"
type = bool
default = true
}

resource "aws_vpc" "test_vpc" {
Expand All @@ -12,7 +17,7 @@ resource "aws_subnet" "test_subnet" {
vpc_id = aws_vpc.test_vpc.id
cidr_block = "10.0.1.${count.index * 64}/26"
map_public_ip_on_launch = true
availability_zone = element(["REGION"], count.index)
availability_zone = element(["us-east-1a"], count.index)
}

resource "aws_internet_gateway" "test_igw" {
Expand Down Expand Up @@ -66,22 +71,21 @@ resource "aws_ecs_service" "test_service" {
launch_type = "EC2"

network_configuration {
subnets = aws_subnet.test_subnet.*.id
subnets = [aws_subnet.test_subnet[0].id]
security_groups = [aws_security_group.test_sg.id]
}
}

resource "aws_efs_file_system" "example2" {
creation_token = "my-product2"
resource "aws_efs_file_system" "example" {
creation_token = "my-product"

tags = {
Name = "MyProduct2"
Name = "MyProduct"
}
}
resource "aws_efs_mount_target" "example2" {
count = length(aws_subnet.test_subnet.*.id)
file_system_id = aws_efs_file_system.example2.id
subnet_id = element(aws_subnet.test_subnet.*.id, count.index)
resource "aws_efs_mount_target" "example" {
file_system_id = aws_efs_file_system.example.id
subnet_id = aws_subnet.test_subnet[0].id
security_groups = [aws_security_group.test_sg.id]
}
# IAM Role for EC2 Instances (if not already defined)
Expand Down Expand Up @@ -169,7 +173,7 @@ resource "aws_autoscaling_group" "app_asg" {
version = "$Latest"
}

vpc_zone_identifier = aws_subnet.test_subnet.*.id
vpc_zone_identifier = [aws_subnet.test_subnet[0].id]

tag {
key = "Name"
Expand Down Expand Up @@ -280,7 +284,7 @@ resource "aws_iam_policy" "ecr_policy" {
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage"
],
Resource = "arn:aws:ecr:REGION:ACCOUNT-ID:repository/qwenlight"
Resource = "arn:aws:ecr:us-east-1:ACCOUNT-ID-HERE:repository/qwenlight"
}
]
})
Expand Down Expand Up @@ -313,7 +317,7 @@ resource "aws_ecs_task_definition" "app_task" {
name = "efs-volume"

efs_volume_configuration {
file_system_id = aws_efs_file_system.example2.id
file_system_id = aws_efs_file_system.example.id
root_directory = "/"
transit_encryption = "ENABLED"
}
Expand All @@ -323,19 +327,27 @@ resource "aws_ecs_task_definition" "app_task" {
"name": "s3-sync-container",
"image": "amazon/aws-cli",
"entryPoint": ["sh", "-c"],
"command": ["aws s3 sync s3://qwenvlchat /qwenvl"],
"command": [aws s3 sync s3://qwenvlchat /qwenvl"],
"mountPoints": [
{
"sourceVolume": "efs-volume",
"containerPath": "/qwenvl",
"readOnly": false
}
],
"essential": true
"essential": true,
"log_configuration": {
"log_driver": "awslogs",
"options": {
"awslogs-group": "/ecs/app-task-logs",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "s3-sync-container"
}
}
},
{
name = "qwenfastapi-container"
image = "ACCOUNT-ID.dkr.ecr.REGION.amazonaws.com/qwenlight:latest"
image = "ACCOUNT-ID-HERE.dkr.ecr.us-east-1.amazonaws.com/qwenlight:latest"
cpu = 2048
memory = 32768
essential = true
Expand Down

0 comments on commit f015808

Please sign in to comment.