ServerlessECS is a generic example of deploying a serverless application on AWS using ECS and Docker. It includes flexible configurations for IAM roles, ECS task definitions, and log retention policies. Written in Python 3.12, this repository offers a scalable and general-purpose solution, easily deployable with the Serverless Framework.
- Node.js: Ensure you have Node.js installed.
- Python 3.xx: Ensure you have Python installed (tested on 3.12).
- Docker: Ensure you have Docker installed.
- AWS CLI: Ensure you have the AWS CLI installed and configured with your AWS account.
- AWS Account: Ensure you have an AWS account with the necessary permissions to deploy the Serverless application.
- Serverless Framework: Install the Serverless Framework (v3.38 is still free to use) globally using npm:
npm install -g serverless
-
Install project dependencies:
npm install
-
Deploy the Serverless application:
sls deploy -r us-east-1 --verbose -s prod
Run task as a service:
aws ecs create-service \
--cluster CLUSTER_NAME \
--service-name hello-world-service \
--task-definition hello-world-prod \
--desired-count 1
Run task as a standalone task:
aws ecs run-task \
--cluster CLUSTER_NAME \
--task-definition hello-world-prod