Setting Up EDDI on AWS with MongoDB Atlas
This guide provides step-by-step instructions to set up EDDI on Amazon ECS and connect it to a MongoDB Atlas cluster.
Prerequisites
AWS Account: Ensure you have an AWS account with the necessary permissions to create ECS clusters, task definitions, and IAM roles
MongoDB Atlas Account: Create an account on MongoDB Atlas if you don't have one
Step 1: Set Up MongoDB Atlas
1. Create a MongoDB Atlas Cluster
Sign Up / Log In:
Go to MongoDB Atlas and log in
Create a New Cluster:
Click "Build a Cluster"
Choose AWS as the cloud provider and select a region
Choose the free tier (for development) or an appropriate plan for production purposes
Click "Create Cluster"
Configure Cluster:
After the cluster is created, click on "Connect"
Select "Connect Your Application"
Copy the connection string (e.g.,
mongodb+srv://<user>:<password>@<host>/eddi?retryWrites=true&w=majority -Dmongodb.database=eddi
)
2. Create a Database User
Add Database User:
Navigate to "Database Access" under the "Security" tab
Click "Add New Database User"
Create a user with the required roles and note the username and password
3. Whitelist IP Addresses
Network Access:
Navigate to "Network Access" under the "Security" tab
Click "Add IP Address"
Add the IP addresses that need access, including your local machine and ECS IP range
Step 2: Set Up Amazon ECS
1. Create a Task Definition
Navigate to ECS:
Go to the Amazon ECS console
Click "Task Definitions" and then "Create new Task Definition"
Select "FARGATE" as the launch type
Configure Task Definition:
Use the following JSON configuration:
2. Create an ECS Cluster
Create Cluster:
Navigate to "Clusters" and click "Create Cluster"
Choose "Networking only" (Fargate) and follow the prompts
3. Create a Service
Create Service:
Go to "Services" and click "Create"
Select your cluster and task definition
Configure the service with the desired number of tasks and networking settings
Step 3: Connect EDDI to MongoDB Atlas
Modify Application Configuration:
Ensure that your EDDI application uses the MongoDB connection string from the environment variables
Update any necessary configuration files
Deploy the Application:
Deploy your EDDI application to ECS using the service created
Test the Connection:
Verify that the application connects to MongoDB Atlas by checking application logs and MongoDB Atlas metrics
Security Considerations
Encryption:
Use TLS/SSL for encrypted connections (
ssl=true
in the connection string)
IAM Roles:
Assign IAM roles to ECS tasks to limit permissions
Network Configuration:
Place ECS tasks in private subnets and use a NAT gateway for internet access
Configure security groups for ECS tasks and MongoDB Atlas
By following these steps, you can set up EDDI on Amazon ECS and connect it to MongoDB Atlas securely and efficiently. If you encounter any issues or have further questions, please refer to the AWS and MongoDB Atlas documentation or contact support.
Last updated