40 lines
945 B
HCL
40 lines
945 B
HCL
resource "aws_ecs_cluster" "my_cluster" {
|
|
name = "my_cluster"
|
|
}
|
|
|
|
resource "aws_ecs_task_definition" "my_api" {
|
|
family = "my-api"
|
|
execution_role_arn = aws_iam_role.my_api_task_execution_role.arn
|
|
container_definitions = <<EOF
|
|
[
|
|
{
|
|
"name": "my-api",
|
|
"image": "mohitmutha/simplefastifyservice:1.0",
|
|
"portMappings": [
|
|
{
|
|
"containerPort": 3000
|
|
}
|
|
],
|
|
"logConfiguration": {
|
|
"logDriver": "awslogs",
|
|
"options": {
|
|
"awslogs-region": "ap-southeast-2",
|
|
"awslogs-group": "/ecs/my-api",
|
|
"awslogs-stream-prefix": "ecs"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
EOF
|
|
# These are the minimum values for Fargate containers.
|
|
cpu = 256
|
|
memory = 512
|
|
requires_compatibilities = ["FARGATE"]
|
|
network_mode = "awsvpc"
|
|
}
|
|
|
|
resource "aws_cloudwatch_log_group" "my_api" {
|
|
name = "/ecs/my-api"
|
|
}
|
|
|