Skip to content

CodeCraft Hub

Accessing AWS Fargate ECS(Task) via SSH

DevOps, AWS1 min read


Amazon ECS is a container orchestration service designed for deploying, managing, and scaling containerized applications. Particularly with Fargate, you can run containers without the need to manage EC2 instances. This blog post guides you on how to access ECS(Task) running on AWS Fargate via SSH.


AWS Account and ECS Cluster: You need an AWS account with the necessary permissions to create and manage ECS clusters.

ECR or Another Container Registry Usage: Make sure to use an ECR or another container registry for storing and fetching container images.

Accessing Fargate ECS(Task) via SSH

1. Check ECS Task Using AWS CLI or Console

Since Fargate ECS(Task) doesn't involve direct access to EC2 instances, SSH access is not possible. Instead, use AWS CLI or the console to inspect the Task's logs and troubleshoot any issues.

2. Debugging via CloudWatch Logs

Logs from a Fargate Task are recorded in CloudWatch Logs. Navigate to CloudWatch Logs using AWS CLI or the console to examine logs and find information that might help in troubleshooting.

3. Utilize AWS Systems Manager Session Manager

As direct SSH access is challenging in Fargate, leverage AWS Systems Manager Session Manager. Initiate a remote shell session and inspect logs. Install Session Manager if you don't have it.

  • Check the service is enabled ExcuteCommand and make it true if it's the value is false.

  • Starting a Session with AWS Systems Manager:

  • Connecting a task via ssh

Ensure that the ECS Task execution role has the necessary permissions, especially the AmazonSSMManagedInstanceCore policy. Navigate to the AWS Systems Manager console, go to the Session Manager section, and start a session.

2023 07 27 12 30 16


Fargate necessitates the use of AWS management services like CloudWatch Logs and AWS Systems Manager Session Manager for debugging and access. Grant the required permissions to the ECS Task execution role for utilizing AWS Systems Manager Session Manager effectively. Instead of attempting direct SSH access to AWS Fargate ECS(Task), leverage AWS management services for log inspection and debugging.

© 2024 by CodeCraft Hub. All rights reserved.
Powered by Gatsby