This project combines the functionality of an S3 build pipeline and a builder server to automate the deployment of applications using AWS services. The setup leverages AWS ECS, ECR, and task definitions to automatically save application builds to S3 and deploy them properly.
The goal of this project is to automate the build and deployment process of applications. It utilizes a GitHub repository link provided in an ECS task definition to trigger the build process. The built artifacts are then saved to an S3 bucket, and the application is deployed using AWS ECS.
- GitHub Repository: Source code repository containing the application.
- Docker: Used to containerize the application.
- AWS ECR (Elastic Container Registry): Stores Docker images.
- AWS ECS (Elastic Container Service): Manages and runs Docker containers.
- AWS S3 (Simple Storage Service): Stores build artifacts.
- Builder Server: Executes build scripts and interacts with AWS services.
- AWS account with necessary permissions
- Docker installed
- AWS CLI configured
- GitHub repository with application code
- Node.js installed for the build process
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::vercel-clone-outputs/*"
},
{
"Sid": "AllowWebAccess",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::vercel-clone-outputs/*"
}
]
}
git clone <your-github-repo-url>
cd <your-repo-directory>
docker build -t builder-server .
- Authenticate Docker to ECR:
aws ecr get-login-password --region <your-region> | docker login --username AWS --password-stdin <your-account-id>.dkr.ecr.<your-region>.amazonaws.com
- Tag the Docker image:
docker tag builder-server:latest <your-account-id>.dkr.ecr.<your-region>.amazonaws.com/builder-server:latest
- Push the Docker image:
docker push <your-account-id>.dkr.ecr.<your-region>.amazonaws.com/builder-server:latest
Create a new task definition in AWS ECS with the following configuration:
- Container image:
<your-account-id>.dkr.ecr.<your-region>.amazonaws.com/builder-server:latest
- Environment variables:
GIT_REPOSITORY__URL
: URL of your GitHub repositoryPROJECT_ID
: Unique identifier for the project
Run the ECS task using the created task definition. This will trigger the build process, save the artifacts to S3, and deploy the application.
- Push code changes to the GitHub repository.
- The ECS task automatically detects the changes, builds the application, and uploads the artifacts to S3.
- The built application is deployed using AWS ECS.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.