Abstract
SSH into Container from your own laptops. Great for debugging containers under ECS.
Setup Checklist:
- Enable ECS Exec
- Install Session Manager Plugin for AWS Cli
- Add SSM permission via IAM Policy to the ECS Role
- Check if ECS Exec is configured properly
- SSH into ECS Container
Enable ECS Exec
For Existing ECS Cluster
Caution
Only new ECS Task under the ECS Service will have the ECS Exec enabled!
New ECS Cluster
- Option 1: Using Terraform
- Option 2: Using Cli
- Based on what I know, there isn’t a way to enable ECS EXEC from the GUI console
Get into ECS Container
Install Session Manager Plugin for AWS Cli
Add SSM permission via IAM Policy to the ECS Role
NOT the execution role!!!
Check if ECS Exec is configured properly
- Script is open-sourced
SSH into ECS Container
Don't want to type the command all the time?
You can make use of AWS Explorer which can be integrated into your code editor. Then you just need to click a few buttons to have a shell into the ECS Container. No more manual copy-paste and modifying the command!
Error Connecting?
Try create a new Task deployment