The Stack Overflow podcast is back! Listen to an interview with our new CEO.
16

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 ...


7

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-...


6

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 ...


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 ...


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

Fargate is more expensive than EC2 for the same vCPU/RAM amount. For example: m5.large (2 vCPU, 8 GB RAM) costs $0.096/hr which is ca $69.12/month Fargate container with 2vCPU and 8 GB RAM costs $0.2028/hr or $146.02/month If you want to run your container 24x7 you'll be much better off running it on an EC2 instance. However if your containers only run ...


3

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 ...


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 ...


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

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

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

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

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

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 ...


1

If you are going full on AWS, I would suggest to have a look at AWS SSM parameters. When EC2 or ECS container are starting, you have a script that is going to fetch the parameters. Then you can do whatever you need to do: replace variables in config files with the parameters fetched previously for example. You could also use files stored in S3. You would be ...


1

In your terraform {...} section you need a backend directive to store your state somewhere: https://www.terraform.io/docs/state/remote.html (OP later explain that the code above is just a module imported from a main file). S3 backends might be the easiest to use and probably to most commonly used backends to store remote state across different executions of ...


1

The key here is the behavior of AWS AMIs in the context of ECS. By default the AWS ECS Amazon Linux AMI optimized for ECS is in charge of VOLUME management but there's a problem if you copy that AMI and try to launch a new instance -- the SECONDARY volume that ECS uses to deploy docker on can go missing. Troubleshooting steps: Check /var/log/cloud-init-...


1

I understand Fargate gives u access to just the container and not the underlying host. If so, how do you accomplish the above? 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. ...


1

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 ...


1

Why don't you use Terraform for the purpose? It can launch as many instances you want, create network for you, create security groups, ECS, IAMs or whatever you want to create and terminate easily when you want. This is widely used in industry now.


1

We had a similar situation wherein one of our applications had to be built, deployed and be up & running before the second one was. This was because application A has some functionality that should be executed prior to it being referenced via application B. The way we accomplished this was by building it into a single delivery pipeline. That way, all the ...


1

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; ...


1

EC2 (Elastic Compute Cloud) Instance - A Virtual Machine server ELB (Elastic Load Balancer) - A service in EC2 which manages incoming traffic using DNS and managed instances (not seen to the user). Redirects HTTP/TCP requests to instances registered in the ELB. Includes health-check mechanism to include/exclude EC2 instances. ALB Target Group - A group of ...


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