17

I would keep the ECS container instances (I'm talking about the Docker hosts - I don't like AWS terminology here) and the deployment as two separate things. Get your ECS stack up and running. You can manage it through CloudFormation and Auto-scaling groups, that's fine. Just think of your cluster as a platform where you will deploy to, not something you ...


8

Environment variables are defined inside the container and some are passed in the task definition. So you can use describe-task-definition to see the extra variables. To get the default environment of the container image, you can register-task-definition for task with command 'env' and the specific container image for which you want to find out and then run-...


7

Such question could be an indication of a poor architectural slicing into microservices. From What are Microservices?: These services are built around business capabilities and independently deployable by fully automated deployment machinery. The key point missed in such case would be their independently deployable aspect. The point could also be ...


6

You need to follow these steps: Set ECS_CLUSTER=devcluster in /etc/ecs/ecs.config Stop all tasks/containers Remove checkpoint file - /var/lib/ecs/data/ecs_agent_data.json Start ECS agent again as explained here - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-install.html To make sure it uses correct cluster, check logs - docker logs ...


6

Update 12/05/2020: Fargate prices have been greatly reduced over the last months and are now comparable with EC2 prices for the same CPU / RAM configurations. That makes Fargate a valid option for 24x7 workloads. Originally written in 2018 - no longer correct! Fargate is more expensive than EC2 for the same vCPU/RAM amount. For example: m5.large (2 vCPU,...


5

You should have 3 names when you're willing to do a blue/green deployment. Two set of names, one for blue, one for green, which will works as is, and a production entrypoint which will point to either the blue name or green name. The point of a blue/green deployment is to be able to test the full deploy before switching the clients entry point, so your ...


5

Yes, I opened a support ticket and the AWS representative said that Fargate is really intended as a stateless container solution. I took that to mean it's more of a self-made Lambda rather than a managed Docker solution. The suggestion to add persistent storage was taken under consideration and will be added to the feature request list. You can add the ...


4

This error CannotPullContainerError usually occurs when you have no access to the Internet from ECS and thus it doesn't able to pull an image from registry. Make sure you have networking configured in such a way to have an access to Internet https://stackoverflow.com/questions/48226547/aws-fargate-cannotpullcontainererror-500 Manually you can confirm ...


4

Unless you are using the AWS API Gateway, you'll still need some way of "serving" your Flask API. You will also need to provision an EC2 instance and run something to serve your API. Instead of running a windows EC2 instance with IIS you can save about 50% operating cost and use Nginx on a linux EC2 instance. Additionally, Nginx can be used as a reverse ...


4

Look at AWS Fargate - it lets you run your Docker containers without having to spin up the EC2 instances for an ECS cluster. You simply schedule the Tasks (or Services), each gets is own IP address and they can talk to each other. You can also use AWS Service Discovery to facilitate the registration and lookup of the tasks' IP addresses. BTW Note that the ...


4

AWS provide different services and categories them on base of computation, storage, databases, management, Analytics, Messaging, Developer Tools etc. ECS comes under the computing services. Amazon EC2 Container Service (ECS) – Container Management for the AWS Cloud Run your applications packaged as Docker containers.EC2 Container Service (or ECS for ...


4

Underlying reason: The ECS service's network access security group did not have permission to access EFS. Solution: Add an inbound rule for type NFS in the security group as described in this tutorial: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/tutorial-efs-volumes.html#efs-security-group


4

This is by design because AWS have yet to upgrade LATEST to point to v1.4.0 (as per 2020-06-23, see AWS ECS Developer Guide). Set the service platform version explicitly to 1.4.0 (instead of LATEST).


3

For simple use case described I would suggest checking Elastic Beanstalk for Docker, it's not the minimal solution like bare ECS usage, but you can benefit from auto-managed and configured services like ELB, EC2 AutoScale, health monitoring and much more. High-level summary: Configure Elastic Beanstalk to use specific tag myimage:tested Use Code Pipeline/...


3

It depends on several factors. If your images can be public or must be private. If you can make a public image, docker hub could work. With ECR you will have a fine grain control of your permissions, integrated with IAM On the other hand, ECR it's only available on one region so if you pull an image from a different region you will be charged for that ...


3

Have you tried using awsvpc mode? https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html You can follow this tutorial - https://docs.aws.amazon.com/AmazonECS/latest/userguide/create-public-private-vpc.html You need a VPC, with at least two subnets, one private and one public. After that the sky is the limit ... If you need internet ...


3

Fargate is absolutely suitable for web apps. We have many customers that use it that way (and many others that use it in a more "batchy" way). Fargate is a managed compute engine and AWS takes a more responsibilities in terms of scaling, patching, security, and so forth so comparing raw Fargate costs to raw EC2 costs isn't how I would compare them. ...


3

But from what I've understood Fargate is more suitable for container that have a limited lifetime? That's not strictly correct, Fargate capabilities include tasks which are suitable for short-term limited lifetime tasks as well as services which are designed to run all the time. For sure, Fargate is more expensive as compared to EC2 - but you don't need to ...


2

The way a cluster becomes aware of the EC2 instances associated to it, is a configuration file used by the ECS agent. You can modify this file, located at /etc/ecs/ecs.config, and name a different cluster. Then restart the ECS agent. This will effectively "move" the EC2 instance to the other cluster. More information about ecs.config in the documentation - ...


2

There are two important parameters that you can use wisely to deal with AWS ECS task definition. memory: The hard limit (in MiB) of memory to present to the container. If your container attempts to exceed the memory specified here, the container is killed. memoryReservation: Docker attempts to keep the container memory to this soft limit; ...


2

Example in AWS cli that should work to get the ASG name a=curl 'http://169.254.169.254/latest/meta-data/instance-id'; aws autoscaling describe-auto-scaling-instances --instance-ids $a --query 'AutoScalingInstances[*].AutoScalingGroupName'


2

Just make sure the images you build all have the right names in terms of registry prefix and so on. If not you need to rename them accordingly. Otherwise this task is pretty easy. To push all Images you build using a docker-compose file just use docker-compose push. Make sure you are authorised to push to the registry (logged in etc.)


2

From your comment I assume a cpu load under 5% in average considering all instances together. Each of your actual instance can be a pod on a kubernetes node, using quite larger instances you can reduce to a dozen of m3 or m4 machines with a single (or two) load balancer in front for the same quality of service. You'll have machines used at 70% (ideally) ...


2

Running Jenkins on EC2 is the better option. It's better to keep the functions that manage your containers separate from the containers themselves. I know this is different than Kubernetes, but this isn't Kubernetes. Build an ELK Stack on EC2 as well and send your build logs to that instance so you can go through them when troubleshooting. It sounds like ...


2

This is a well-written and up-to-date article which summarises the problem I've hit and confirms there isn't really a perfect solution at the moment in Fargate. https://hackernoon.com/secrets-management-within-aws-ecs-1b6975819ccd - Connor Beardsmore The alternatives listed are: Bake into Docker - not an option with an open source repo ECS Environment ...


2

I don't think you can trigger re-deployment based on ECS image being updated. You can however do it as part of your Jenkins pipeline - after you push to ECR as a next step in the pipeline can run a script that will reload the task. In fact in my pipelines I deploy the ECS Tasks through CloudFormation templates and the CloudFormation stack update is part of ...


2

The goal can be achieved via several solutions. We can use service with awsvpc as network mode, so your service can get a real "A" DNS record and ENI interface, you must pay attention with this solution, ec2 instances has a limited number of ENI that can be attached, for a micro or small I think max 3. Other solution more flexible is to use an internal NLB ...


2

If task definition is using "latest" as image tag in container definition,to update ecs service in order to pull new image from ECR with "latest" tag. You can simply do Force new deployment aws ecs update-service --cluster --service --force-new-deployment --profile All though using "latest" tag for deployment is not good practice


2

Options are: Use CodeBuild to push the new image. Make sure the task definition is using the "latest" tag. You'll need to force the deployment of the task definition to pick the new image. Use CodePipeline to update ECS. It will automatically generate a new task definition revision with the new image and deploy it.


2

I think this is because your ECS service was created before tagging was available for ECS services. See this blog post by AWS on how to migrate to the new ARN format. https://aws.amazon.com/blogs/compute/migrating-your-amazon-ecs-deployment-to-the-new-arn-and-resource-id-format-2/


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