Welcome to a user-friendly guide on deploying a demonstrated architecture using Amazon ECS, backed by Terraform! This tutorial will walk you through the procedures, steps, and necessary components in a way that’s easy to understand.
Table of Contents
Solution Overview
This repository contains Terraform code designed to deploy a solution for running demos. It exemplifies how AWS resources can be orchestrated to minimize defects in deployment, ease remediation, lower risks, and facilitate seamless transitions into production environments while harnessing a managed underlying framework for containers.
General Information
The project is segmented into two primary components:
- Code: For the running applications, divided into:
- Client: Frontend application coded in Vue.js
- Server: Backend application coded in Node.js
- Infrastructure: Contains Terraform code for deploying necessary AWS resources.
Infrastructure
The Infrastructure folder provides the Terraform code needed to deploy AWS resources. Think of these resources as the building blocks of your project.
- The Modules folder contains reusable Terraform blocks.
- The Templates folder is where configuration files reside.
- Terraform state can be stored locally or set to a remote configuration such as an AWS S3 Bucket.
Infrastructure Architecture
The architecture designed establishes a robust groundwork, including:
- Networking resources following high-availability standards
- ECR Repositories
- An ECS Cluster and Services
- Task definitions, autoscaling policies, and alarm notifications
- Application load balancers, IAM policies, and Cloud-based applications
Infrastructure Considerations Due to Demo Proposals
The task definition in the provided example uses hardcoded values. You can modify this using commands in CodeBuild to adapt the values dynamically as needed.
CICD Architecture
A similar architectural layout governs the CI/CD process, integrating deployment pipelines that can be visualized through diagrams.
Prerequisites
Before launching the infrastructure resources, ensure to follow these steps:
- Install Terraform (version 0.13 or above). You can download it from the Terraform official webpage.
- Configure the AWS credentials on your machine (create a file at ~/.aws/credentials using the specified format).
- Generate a GitHub token as per guides available at GitHub documentation.
Usage
To use the solution:
- Fork the repository and authenticate your GitHub token.
- Clone the repository to your local machine and navigate to the Infrastructure directory.
- Run
terraform init
to set up your environment. - Configure your environment variables and run
terraform plan
to preview your changes. - Execute
terraform apply
to launch your infrastructure. - Check the AWS Management Console for the CodePipeline service status and proceed to use your application.
Autoscaling Test
Testing your application under traffic peak loads is crucial. We utilize Artillery for this, so follow this link to ensure you have it installed.
Application Code
Client App
The client side employs Vue.js, with the structured assets necessary for full functionality. Make sure to add assets to the S3 bucket and configure the required DynamoDB structure.
Client Considerations Due to Demo Proposals
Asset dependencies on S3 must be established and necessary items must be added to DynamoDB.
Server App
The backend, constructed with Node.js, manages health check endpoints and interfaces with DynamoDB. Swagger is utilized for API documentation.
Cleanup
Post-experimentation, to clean up the resources, run the command: terraform destroy
alongside your variables.
Security
For security best practices, see the security notification documentation.
License
This project is under the MIT-0 License, as detailed in the LICENSE file.
Troubleshooting
If you encounter issues, consider the following:
- Verify your AWS credentials and environment variables.
- Ensure your Terraform version is compatible.
- Your GitHub token has the necessary permissions granted.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.