> For the complete documentation index, see [llms.txt](https://docs.graph.build/EGeX4aTAJLlpg9Hh8kfl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.graph.build/EGeX4aTAJLlpg9Hh8kfl/getting-started-tutorial/installation/aws/create-and-run-ecs-services-and-tasks-v2.md).

# Create & Run ECS Services & Tasks v2

Graph.Build AWS Marketplace products are Docker images which run on Amazon ECS.

You can find all the docker images on the [Graph.Build page at the Amazon ECR Public Gallery](https://gallery.ecr.aws/graph.build).&#x20;

1. Create an Amazon S3 bucket for Graph.Build to use for graph model staging. You will need this in the Task Definition below. We recommend creating a bucket that follows a format similar to: `s3://graph-build-{AWS_ACCOUNT_ID}`
2. Create  / Update an `ecsTask` and `ecsTaskExecution` role in IAM. The roles should include access to S3 (specifically the bucket from step 1) for graph model staging and configuration, CloudWatch for logging, and Neptune to be able to write to Amazon Neptune.&#x20;
3. Using the below example Task Definition as a guide, create a Task Definition that suits your requirements, referring to the [Amazon ECS documentation](https://docs.aws.amazon.com/ecs/) to see how to create Task Definitions,  and run ECS services and tasks.

See the below example ECS Task Definition to run a Graph.Build stack, replacing these values as necessary.&#x20;

> <mark style="color:red;">**Warning:**</mark> <mark style="color:red;"></mark><mark style="color:red;">AWS Service Connect is not currently supported for setting the STUDIO\_NODE\_HOST environment variable</mark>

<table><thead><tr><th width="261">Name</th><th width="237">Description</th><th>Example</th></tr></thead><tbody><tr><td><pre><code>GRAPH_DATABASE_ENDPOINT
</code></pre></td><td>Target graph database endpoint for writing to. </td><td>https://xxx.cluster-xxxe.us-east-1.neptune.amazonaws.com:8182/</td></tr><tr><td><pre><code>AWS_REGION
</code></pre></td><td>The AWS region in which the stack will run</td><td>us-east-1</td></tr><tr><td><pre class="language-markup"><code class="lang-markup">AWS_ACCOUNT_ID
</code></pre></td><td>Your 12 digit AWS account ID</td><td>XXXXXXXXXXXX</td></tr><tr><td><pre><code>STUDIO_NODE_HOST
</code></pre></td><td><mark style="color:red;">The hostname or IP address of the EC2 instance being used by this ECS cluster</mark></td><td>145.225.875.888</td></tr></tbody></table>

The containers included to run in this example ECS Task Definition are:&#x20;

* Studio Node
* Studio UI
* Semi Structured Transformer x1
* SQL Transformer x1
* Graph Writer x1

```json
{
    "family": "graphbuild-full-stack",
    "containerDefinitions": [
        {
            "name": "graph-writer",
            "image": "public.ecr.aws/graph.build/graph-writer:latest",
            "cpu": 512,
            "memory": 1024,
            "portMappings": [
                {
                    "name": "graph-writer-8080-tcp",
                    "containerPort": 8080,
                    "hostPort": 9610,
                    "protocol": "tcp"
                }
            ],
            "essential": true,
            "environment": [
                {
                    "name": "GRAPH_DATABASE_TYPE",
                    "value": "neptune-sparql"
                },
                {
                    "name": "TRANSFORMER_RUN_STANDALONE",
                    "value": "true"
                },
                {
                    "name": "GRAPH_DATABASE_ENDPOINT",
                    "value": "https://{GRAPH_DATABASE_ENDPOINT}:8182/sparql"
                },
                {
                    "name": "DELETE_SOURCE",
                    "value": "true"
                }
            ],
            "mountPoints": [],
            "volumesFrom": [],
            "dockerLabels": {},
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-group": "/ecs/graphbuild-stack",
                    "awslogs-create-group": "true",
                    "awslogs-region": "{AWS_REGION}",
                    "awslogs-stream-prefix": "ecs"
                }
            },
            "systemControls": []
        },
        {
            "name": "semi-structured-transformer",
            "image": "public.ecr.aws/graph.build/semi-structured-transformer:latest",
            "cpu": 512,
            "memory": 2048,
            "portMappings": [
                {
                    "name": "semi-structured-8080-tcp",
                    "containerPort": 8080,
                    "hostPort": 9603,
                    "protocol": "tcp"
                }
            ],
            "essential": true,
            "environment": [
                {
                    "name": "TRANSFORMER_DIRECTORY",
                    "value": "s3://graph-build-{AWS_ACCOUNT_ID}/ss/"
                },
                {
                    "name": "TRANSFORMER_RUN_STANDALONE",
                    "value": "true"
                },
                {
                    "name": "RECORD_PROVO",
                    "value": "false"
                },
                {
                    "name": "PROPERTY_GRAPH_MODE",
                    "value": "false"
                },
                {
                    "name": "MAX_CSV_ROWS",
                    "value": "50000"
                }
            ],
            "mountPoints": [],
            "volumesFrom": [],
            "dockerLabels": {},
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-group": "/ecs/graphbuild-stack",
                    "awslogs-create-group": "true",
                    "awslogs-region": "{AWS_REGION}",
                    "awslogs-stream-prefix": "ecs"
                }
            },
            "systemControls": []
        },
        {
            "name": "sql-transformer",
            "image": "public.ecr.aws/graph.build/sql-transformer:latest",
            "cpu": 512,
            "memory": 2048,
            "portMappings": [
                {
                    "name": "sql-transformer-8080-tcp",
                    "containerPort": 8080,
                    "hostPort": 9602,
                    "protocol": "tcp"
                }
            ],
            "essential": true,
            "environment": [
                {
                    "name": "TRANSFORMER_DIRECTORY",
                    "value": "s3://graph-build-{AWS_ACCOUNT_ID}/sql/"
                },
                {
                    "name": "TRANSFORMER_RUN_STANDALONE",
                    "value": "true"
                },
                {
                    "name": "RECORD_PROVO",
                    "value": "false"
                },
                {
                    "name": "PROPERTY_GRAPH_MODE",
                    "value": "false"
                }
            ],
            "mountPoints": [],
            "volumesFrom": [],
            "dockerLabels": {},
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-group": "/ecs/graphbuild-stack",
                    "awslogs-create-group": "true",
                    "awslogs-region": "{AWS_REGION}",
                    "awslogs-stream-prefix": "ecs"
                }
            },
            "systemControls": []
        },
        {
            "name": "studio-ui",
            "image": "public.ecr.aws/graph.build/studio-ui:latest",
            "cpu": 512,
            "memory": 1024,
            "portMappings": [
                {
                    "name": "mapping-ui-3000-tcp",
                    "containerPort": 80,
                    "hostPort": 9600,
                    "protocol": "tcp"
                }
            ],
            "essential": true,
            "environment": [
                {
                    "name": "REACT_APP_NODEAPP_HOST",
                    "value": "http://{STUDIO_NODE_HOST}:9601"
                }
            ],
            "mountPoints": [],
            "volumesFrom": [],
            "dockerLabels": {},
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-group": "/ecs/graphbuild-stack",
                    "awslogs-create-group": "true",
                    "awslogs-region": "{AWS_REGION}",
                    "awslogs-stream-prefix": "ecs"
                }
            },
            "systemControls": []
        },
        {
            "name": "studio-node",
            "image": "public.ecr.aws/graph.build/studio-node:latest",
            "cpu": 512,
            "memory": 1024,
            "portMappings": [
                {
                    "name": "mapping-ui-node-js-8080-tcp",
                    "containerPort": 9601,
                    "hostPort": 9601,
                    "protocol": "tcp"
                }
            ],
            "essential": true,
            "environment": [
                {
                    "name": "NODE_ENV",
                    "value": "production"
                },
                {
                    "name": "DATABASE_CLIENT",
                    "value": "better-sqlite3"
                }
            ],
            "mountPoints": [
                {
                    "sourceVolume": "sqlite-db",
                    "containerPath": "/app/dist/database/sqlite",
                    "readOnly": false
                }
            ],
            "volumesFrom": [],
            "readonlyRootFilesystem": false,
            "dockerLabels": {},
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-group": "/ecs/graphbuild-stack",
                    "awslogs-create-group": "true",
                    "awslogs-region": "{AWS_REGION}",
                    "awslogs-stream-prefix": "ecs"
                }
            },
            "systemControls": []
        }
    ],
    "taskRoleArn": "arn:aws:iam::{AWS_ACCOUNT_ID}:role/graphBuildECSRole",
    "executionRoleArn": "arn:aws:iam::{AWS_ACCOUNT_ID}:role/graphBuildECSRole",
    "volumes": [
        {
            "name": "sqlite-db",
            "host": {
                "sourcePath": "/app/dist/database/sqlite"
            }
        }
    ],
    "placementConstraints": [],
    "requiresCompatibilities": [
        "EC2"
    ],
    "tags": [
        {
            "key": "ecs:taskDefinition:createdFrom",
            "value": "ecs-console-v2"
        }
    ]
}
```
