51 votes

How do you restart all Tasks of a Service?

Using the AWS CLI tool: aws ecs update-service --force-new-deployment --service my-service --cluster cluster-name
Ben Whaley's user avatar
  • 1,443
38 votes
Accepted

Confused by the role requirement of ECS

The only necessary role is the Container Instance IAM role. This role allows the ECS agent (running on your EC2 instance) to communicate with Amazon ECS. There are five other roles that you may also ...
Samuel Karp's user avatar
21 votes
Accepted

Update the container of a service in Amazon ECS

Not sure if this is considered as abandoned question - stumbled upon this while troubleshooting my issue and now adding my solution now that it's resolved. To update service with new container, you ...
uiron's user avatar
  • 326
21 votes
Accepted

AWS Code Build Error : Cannot connect to docker daemon

I am answering my own question, so it may help some one who is getting same issue. Solution was pretty straightforward, i need to check the privilaged tab which i didn't notice. Solution : From the ...
Sreeraju V's user avatar
17 votes
Accepted

Assigning a domain name to an AWS Fargate task

For most cases, you most likely want to use an ALB/NLB for service discovery. While there are some costs, you also get a lot of benefits: Some DoS protection, scaling metrics, logging, SSL/TLS ...
M. Glatki's user avatar
  • 2,084
16 votes
Accepted

AWS Fargate + Application Load Balancer SSL Termination

Yes it is possible. Create a SSL certificate for your domain in ACM (Amazon Certificate Manager). Create a HTTPS Listener in the ALB that will listen on port 443 and configure it to use the above ...
MLu's user avatar
  • 25.5k
13 votes
Accepted

How to turn off access log for only a certain url in this nginx configuration?

Here's an easy way - add this location block. location ~ /documents/ping { proxy_pass http://127.0.0.1:5000/$1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; ...
Tim's user avatar
  • 32.8k
11 votes

ECS cluster has no ecs instances but two ecs instances are visible in EC2

You indicated in your comment that the instances have no public IP addresses. I'm extrapolating from that comment that your instances likely have no route to the Internet as well. In order to use ...
Samuel Karp's user avatar
9 votes

CannotPullContainerError on AWS ECS

The registry url is … blank. Just the same as the docker command line, if you give ECS an image with no repository url: eventstore/eventstore it will pull it from dockerhub. (This surprised me too....
Chris F Carroll's user avatar
9 votes
Accepted

Ecs service doesn't update the task definition

As I found out later on, the reason for not updating the task is that the desired count is set to 2 and there are only 2 EC2 instances available. So the ECS agent tries to retain the desired count ...
Lahiru Liyanapathirana's user avatar
9 votes
Accepted

how to pull docker image on ECR using cloudformation template

Using ECR, EC2 and docker, you are still required to do a docker login. In the user data run aws ecr get-login --no-include-email > login.sh bash login.sh then you should be able to run ...
strongjz's user avatar
  • 852
8 votes

ECR cross-account pull permissions

You also need to configure permissions in the ECR for cross account access. To give pull access to the ECR of Account A to Account B, put the following JSON policy in the ECR Permissions tab. { "...
Razan Paul's user avatar
8 votes

HealthCheck on ECS task without an ELB

The answer by raja and edite by Andrew are slightly off for ECS/FARGATE. It's without the brackets and without the quotes: CMD-SHELL, curl -f http://localhost/ || exit 1 That is the correct format ...
nopuck4you's user avatar
8 votes
Accepted

How to reference container hostname or ip from another container in the same ECS task in cloud formation

If you are using the awsvpc networking mode for your task (which would be a good idea) your task will basically have a single network name space. This means you can reach all of your containers using ...
mreferre's user avatar
  • 476
7 votes

Terraform returns "Unsupported service namespace, resource type or scalable dimension" when I attach an auto-scaling group to an ECS service

You didn't correctly format the resource_id in your aws_appautoscaling_target. It needs to be in the format service/clusterName/serviceName, and terraform will not format it for you. Try: resource_id ...
philippe's user avatar
  • 253
7 votes

What is the best way to run cronjob in AWS ECS?

I'm not familiar with Laravel or Artisan but essentially you'll need to: create a container image with your job (artisan) create a task definition that runs the artisan container when invoked create ...
MLu's user avatar
  • 25.5k
7 votes
Accepted

How to send HTTP requests between AWS ECS services

You've pretty much covered the options right. ECS Service Discovery would be my first pick - all containers will automatically register in the service discovery domain and will be accessible that way....
MLu's user avatar
  • 25.5k
7 votes
Accepted

Do I need an internal Load Balancer for my ECS Services?

Service Discovery is enough. New nodes will be added to the SD name resolution when they are started. Unfortunately many people don't know / use Service Discovery and resort to the more expensive ALB. ...
MLu's user avatar
  • 25.5k
6 votes

How do you restart all Tasks of a Service?

this worked for me: aws ecs list-tasks --cluster <cluster_name> | jq -r ".taskArns[]" | awk '{print "aws ecs stop-task --cluster <cluster_name> --task \""$0"\""}' | sh the tasks then ...
user326608's user avatar
6 votes

HealthCheck on ECS task without an ELB

The Given command is syntatically invalid. it should be [ "CMD-SHELL", "curl -f http://localhost/ || exit 1" ] CMD or CMD-SHELL - to run the command with the container's default shell curl -f ...
raja's user avatar
  • 61
6 votes

Assigning a domain name to an AWS Fargate task

I don't believe @m-glatki's answer is correct - you cannot use Service Discovery for public IP addresses, as mentioned by @andreas-pasch. The only way I've found to implement this was to create a ...
gherk's user avatar
  • 61
6 votes
Accepted

HEALTHCHECK in ECS Container

it seems the documentation on AWS is extremely misleading. When using the ECS portal one should type only comma delimited commands, i.e.: echo,hello world
norbitheeviljester's user avatar
6 votes
Accepted

ALB Connection Draining is always reaching the "Deregistration Delay"

The documentation has meanwhile been updated: If a deregistering target has no in-flight requests and no active connections, Elastic Load Balancing immediately completes the deregistration process, ...
Steven's user avatar
  • 176
6 votes
Accepted

How to choose between Elastic Container Service (ECS) or Elastic Container Registry (ECR), Elastic Beanstalk, and Lambda?

Elastic Beanstalk is your traditional hosting - you can upload a PHP or Java or whatever application, say Wordpress, configure a database, etc, and go. There are some smarts for scaling, recovery, etc,...
MLu's user avatar
  • 25.5k
5 votes

Amazon ECS Network traffic and ports

I suspect this is port related, as it's fairly standard that things in a cluster need to communicate. The two articles below should answer this question for you. It seems to me the following are ...
Tim's user avatar
  • 32.8k
5 votes

Amazon ECS (Docker): binding container to specific IP address

Here's an actual, logical way to do it. It sounds too complicated but you can actually implement it in a matter of minutes, and it works. I'm actually implementing it as we speak. You create a task ...
TheNavigat's user avatar
5 votes

How to get the IP Address for a specific AWS ECS task?

It turns out my original premise (needing to know the task container's own internal IP address for service discovery) is very flawed - that IP address is only usable within a single EC2 Container ...
Jake Feasel's user avatar
5 votes

How to create a private staging environment on AWS?

It's fairly simple: Create an IPsec tunnel between the VPC and your corporate network. Don't assign EIPs or other public addresses to anything other than NAT/egress gateways. If you want to really ...
EEAA's user avatar
  • 110k
5 votes

ECS cluster has no ecs instances but two ecs instances are visible in EC2

are you using an ecs optimized ami? i would do that and then include this in your user-data when you spawn the instance #!/bin/bash echo ECS_CLUSTER=your-cluster-name >> /etc/ecs/ecs.config if ...
reece's user avatar
  • 51
5 votes

AWS ECS service not starting any tasks

I'd check your Events tab in the ECS service. In some cases it will tell you there isn't enough memory to start the container. It's a bit tricky to find without knowing, since it's buried in a tab ...
davegallant's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible