> For the complete documentation index, see [llms.txt](https://empctl.empyrealsdk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://empctl.empyrealsdk.com/03-accessing-infra.md).

# Accessing the infrastructure

The infrastructure components are provisioned on the background for each of the projects.\
Any container/pod that is running on the project's namespace will have access to the infrastructure components.

Our platform is language agnostic. We provide a lightweight library called `emp_hooks` in python that simplifies interacting with infrastructure components but is not at all required or needed to use the platform.

The aws libraries are built to automatically pick up the available credentials from the environment.

For example, the following snippet will access the DynamoDB table and write and read from it.

```python
import boto3
import os

def main():
    region_name = os.getenv('AWS_REGION')
    table_name = os.getenv('AWS_DYNAMODB_TABLE_NAME')
    
    dynamodb = boto3.resource("dynamodb", region_name=region_name)
    table = dynamodb.Table(table_name)

    test_item = {
        "id": "test-id-1",
        "Data": "Hello from the project!"
    }
    table.put_item(Item=test_item)
    print(f"Successfully wrote item to {table_name}: {test_item}")

    response = table.get_item(Key={"id": "test-id-1"})
    item = response.get("Item")
    if item:
        print(f"Successfully read item from {table_name}: {item}")
    else:
        print(f"No item found in {table_name}")

if __name__ == "__main__":
    main()
```

The following infrastructure-related environment variables are automatically injected into each pod:

**DynamoDB Related:**

* `AWS_DYNAMODB_TABLE_ARN` - The ARN of the DynamoDB table
* `AWS_DYNAMODB_TABLE_NAME` - The name of the DynamoDB table

**ECR Related:**

* `AWS_ECR_REPO_URI` - The URI of the ECR repository

**S3 Related:**

* `AWS_S3_BUCKET_ARN` - The ARN of the S3 bucket
* `AWS_S3_BUCKET_NAME` - The name of the S3 bucket

**Secrets Related:**

* `AWS_SECRET_ARN` - The ARN of the AWS Secret
* `AWS_SECRET_NAME` - The name of the AWS Secret

**SQS Related:**

* `AWS_SQS_QUEUE_ARN` - The ARN of the SQS queue
* `AWS_SQS_QUEUE_NAME` - The name of the SQS queue

**Region Configuration:**

* `AWS_REGION` - The AWS region (default: us-east-2)
* `AWS_DEFAULT_REGION` - The AWS default region (default: us-east-2)

**Persistent Volume (EFS) Related:**

* `FILESYSTEM_PATH` - The path to the EFS file system
* `DEPLOYMENT_FILESYSTEM_PATH` - The path for the deployment to use the EFS file system

**Environment:**

* `ENVIRONMENT` - The deployment environment (e.g., production)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://empctl.empyrealsdk.com/03-accessing-infra.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
