Questions tagged [amazon-ec2]

For questions about using Amazon Elastic Compute Cloud in DevOps, including deploying, monitoring and scaling applications in EC2. For questions specifically about monitoring EC2 with [aws-cloudwatch] use that tag. For the EC2 container service use the [amazon-ecs] tag.

Filter by
Sorted by
Tagged with
31
votes
4answers
10k views

Why is the AWS EC2's spot price greater than the on-demand price?

I was trying to provision spot instances via Ansible yesterday, and almost all my requests failed, even when I put my spot price == the on-demand price of that instance. So, when I had a look at the ...
25
votes
5answers
8k views

How to clean up orphaned AWS EC2 snapshots?

We end up with a fair amount of AWS EC2 snapshots where the AMI has been deleted, but the snapshot is left behind to rot. I'd like a non-manual way of identifying and deleting these orphans to save us ...
15
votes
3answers
2k views

How to check AWS spot pricing automatically?

I've been thinking about a Jenkins job to check the pricing for the agent boxes we spin up; every so often the price spikes and it'll be an hour or two before anyone notices that no new agents are ...
14
votes
5answers
29k views

How to run a script or a command on EC2 instance via AWS CLI?

According to New EC2 Run Command news article, AWS CLI should support a new sub-command to execute scripts on remote EC2 instances. However I've checked in aws ec2 help, but I can't find the relevant ...
14
votes
4answers
8k views

How to increase the size of a disk on a running instance on Amazon EC2

I got a running instance of a EC 2 server setup with Ubunto. What's the best way to increase the disk size without any downtime and minimal risk? Reading through the guides, one way would be to ...
13
votes
1answer
655 views

How do you manage your inventory of spot instances on AWS with Ansible

I am new to Ansible, with some experience in Chef. I am considering learn and use Ansible to manage environments. I was wondering, what would be the best practice to manage inventory of AWS spot ...
9
votes
6answers
942 views

How to prevent hug of death on EC2 Instance?

I've a iOS app on the app store and recently I've received a huge surge of traffic to my landing page hosted on EC2 and resulted in the page not responding, luckily I managed to recover it by ...
8
votes
2answers
620 views

Is Azure's confidential computing essentially encrypted RAM?

I'm trying to wrap my head around the Azure confidential computing offering. It appears that that AWS does not offer encryption at the application level (see diagram for what I mean by this:) My ...
8
votes
1answer
269 views

Automate custom docker image deployment on AWS

This question is related to my previous one - but a bit more descriptive. I am trying to build automate the generation and deployment of a docker container. The docker container is created with packer....
7
votes
2answers
3k views

Application calling AWS internal load balancer in same subnet is timing out

Some background: I've created a moderately complex network using Amazon's vpc. It's a three-tiered network across two availability zones. Each layer has a subnet in zone-a and zone-b. The ...
7
votes
1answer
971 views

AWS ECS/EKS: EC2 vs Fargate mode

Amazon offers the option of launching their container management services ECS and EKS in two modes: EC2 and Fargate. In the former, normal VMs (EC2 instances) are used and ECS or EKS (depending on ...
7
votes
1answer
187 views

How to automate submission to Amazon Marketplace?

Is anyone aware of a way to automate the submission of an AMI to Amazon's Marketplace? I want to take a public AMI and share it to the AWS Marketplace so it can be scanned for listing and then submit ...
7
votes
2answers
588 views

Best way to launch 100 identical Docker machines on AWS?

I need to do some large scale testing on a system. The system consists of 2 main parts: Manager and Nodes. There will be only one manager server, but 100 nodes. Both the manager and nodes are Docker ...
6
votes
2answers
2k views

How to find out the used Key pair name via AWS CLI?

I'm aware of get-password-data command which can display PasswordData data like: $ aws ec2 get-password-data --instance-id i-0123456789 { "InstanceId": "i-0123456789", "PasswordData": "\r\...
6
votes
4answers
373 views

DevOps practice on AWS instances

I am new to DevOps, started learning the different tools. I would like to practice all of the tools like Jenkins, Chef, GIT, Puppet, Ansible, Docker, Kubernetes, etc . My question is If I would like ...
6
votes
3answers
160 views

Autoscaling on GoCD agents without terminating active builds?

At the moment I have an AutoScaling Group (ASG) of GoCD build agents without any scaling policies. I have created some custom metrics that indicate how many build agents are currently idle and I'd ...
6
votes
3answers
272 views

Continuously getting locked out from EC2 instance. No supported authentication methods available

I am getting continously locked out from my ec2 instance time and again. I have to take its root volume and attach it to some other instance (mostly new instance) to prevent data loss. I am not able ...
5
votes
5answers
1k views

Bad edit to sudoers file on EC2 instance, how to fix it?

While writing a script to edit the sudoers file without using visudo, the script did not check for issue, and I have introduced some bad edits into the sudoers file, and thus cannot use sudo at all ...
5
votes
2answers
158 views

AWS Spot instances price

While trying to create spot instances I notices that the Price for almost all instance types (from m3 , c3, c4) are always higher than the On-Demand price of corresponding variants in us-east-1c and ...
5
votes
2answers
211 views

What should I use for configuration management on AWS?

I am trying to find a solution for configuration management using AWS OpsWorks. What I can see is AWS offers three services for OpsWorks Chef Automate Puppet AWS stacks I have read basics of all ...
5
votes
1answer
1k views

How does the creation of an AMI on AWS work and why is the creation time unpredictable?

Creation date: September 23, 2019 at 9:22:06 PM UTC+2 21:48: still waiting for completion 21:53: completed Sometimes it takes 15 minutes and sometimes longer. How does a creation of an AMI work and ...
5
votes
1answer
75 views

Large number of host emulation

What would be the best way to emulate (or really to instantiate) a large number of hosts / virtual machines / docker containers in the cloud? Assume I want to run a scenario where 10,000 hosts are ...
5
votes
1answer
188 views

Approaching user adds and edits with Ansible

I am going to be attached to a small project that basically organizes the users in a cluster of AWS Linux servers. The servers users assigned have different UIDS and maybe different GUIDs. I am hoping ...
5
votes
2answers
1k views

How to automate rolling upgrades for ec2 running linux behind elastic and/or application load balancer?

Would like to ask for recommendations on ready automated solutions or templates for rolling ec2 instance upgrade on AWS, requiring a reboot with ELB/ALB. Specifically required to perform the ...
5
votes
2answers
174 views

How to scale-down in a multi-tenant environment?

Cloud environments in AWS allow for multi-tenancy managed by the user himself, classic example are container orchestrators such as ECS or Kubernetes. When you have two services, one needs memory ...
5
votes
4answers
2k views

How can I get a list of encrypted disks for instances that are running on the AWS CLI?

There is a great question here about how to get a list of encrypted disks. I'm currently using the describe-volumes command. For the record I'm currently using: aws ec2 describe-volumes --region us-...
4
votes
3answers
93 views

Ideal methods of handling server logs on AWS

We currently have some ruby applications hosted on EC2 servers on AWS, and every few weeks we see the disk space get completely consumed by the app log as well as the worker logs. What are the best ...
4
votes
2answers
2k views

How to create ansible host file on mac?

When I try to create ansible host file as follows: sudo vi /usr/local/etc/ansible/hosts When I try to save the file I get following error: "/usr/local/etc/ansible/hosts" E212: Can't open file for ...
4
votes
1answer
545 views

AWS Storage Cost for a custom AMI

How does AWS calculate the cost of a custom AMI? If I would create an AMI which is based on Ubuntu 16.04, do I need to pay for the complete size of AMI (e.g. 4GB) or just the differences of my custom ...
4
votes
1answer
472 views

How to terminate EC2 instance in Jenkins via Vagrant when job is stopped manually?

I've freestyle jobs which aims to run EC2 instances via Vagrant (vagrant up), however when I cancel the job manually (by clicking X button), the instances on EC2 are still running. How can I make sure ...
4
votes
1answer
69 views

EC2 EBS Free Tier - Is Storage Reusable?

Can I delete an EC2 instance and start off from scratch on my EBS free tier usage? For instance, I was running a Red Hat server with 10 GB of EBS being used. However, I deleted that EC2 within a few ...
4
votes
2answers
829 views

Is containerized deployment of jenkins on ECS better than running jenkins inside EC2 instance to secure pipeline information?

I am new to AWS, docker and jenkins. I want to run a jenkins build pipeline and I have tried using following two ways on AWS: Running jenkins inside the EC2 instance following the steps at this AWS ...
4
votes
1answer
774 views

How to provide multiple configs for EC2 node using Terraform and cloud-init?

I need to use several configs on my EC2 node using Terraform. data "template_cloudinit_config" "puppetserver_config" { gzip = true base64_encode = true part { ...
4
votes
1answer
3k views

How to get EC2 instance tags when pulling CloudWatch data?

For monitoring purposes, we're pulling AWS/EC2 instances statistics data from CloudWatch and save it to InfluxDB. We're using Telegraf to do this. However, when pulling the data from Cloudwatch, ...
4
votes
2answers
117 views

What is the simplest way to list which attached disks are encrypted (and which not) on AWS?

An auditor is asking for proof that we've encrypted all the disks on our AWS EC2 VPC. I'd like a way to list all the disks and whether they're encrypted or not. I know I can build a report with the ...
4
votes
1answer
2k views

Why don't the instances in the auto-scaling group get assigned public ip addresses unless it's a default vpc?

I'm trying to migrate our deployment process over to aws code deploy (by following instructions here:https://pionect.nl/autoscaling-aws-laravel-codedeploy-opsworks-chef-automation/). When I'm ...
4
votes
1answer
804 views

Preventing an IAM user from overriding launch template parameters on RunInstance

I'm trying to set up an IAM policy that allows a user to run an instance (ec2:RunInstances), but only from a specific launch template - and without making any changes to that launch template's ...
4
votes
1answer
872 views

Create multiple EC2 instances using python script (in loop iteration)

I Have JSON file in which email address and count of instances are specified.I'm using python script to iterate through that file and get username/count number (count number will be used as number of ...
4
votes
1answer
976 views

Unable to launch multiple EC2 instances in different availability zones using terraform

Whenever I try to launch the instances, I am getting the following error message. Please help with this. Error: Error applying plan: 3 error(s) occurred: * aws_instance.example[0]: 1 error(s) ...
3
votes
4answers
415 views

Digital Ocean vs AWS EC2 for Laravel based application

I'm working on a project based on Microservice architecture in Laravel, which means I'll have many small apps and Databases, I'm confused weather I should buy AWS EC2 or Digital Ocean's hosting. My ...
3
votes
3answers
4k views

What is the AWS user permission that allows attaching and detaching IAM Roles to instances?

My coworker is trying to attach IAM roles to EC2 instances and doesn’t have permissions. I’m trying to work out which permissions to give him. My question is: What is the AWS user permission that ...
3
votes
1answer
5k views

How to export EC2 snapshot into S3 bucket?

I've created a snapshot of EC2 instance via: aws ec2 create-snapshot --volume-id vol-xyz In aws ec2 create-snapshot help we can read: Creates a snapshot of an EBS volume and stores it in Amazon ...
3
votes
1answer
383 views

AWS: Application vs Classic Load Balancer

My senario is this: I am using 2 EC2 instances which I want reachable via urls as follows: sub1.domain.com sub2.domain.com I am aware of the fact that AWS Application Load Balancers currently ...
3
votes
1answer
83 views

Saving time on an EC2 instance

I have started playing around with AWS (privately). I have one free tier Amazon Linux 2 VM running right now, which serves a "fat" service (in a docker container) to myself and one other person. It ...
3
votes
1answer
207 views

How to securely pass sensitive data to EC2 Spot instances?

Right now, we only use EC2 on-demand instances, and we provision sensitive data (credentials, private keys, etc.) on the instances' EBS which are encrypted with a KMS key. My understanding is that I ...
3
votes
1answer
71 views

Is running load balanced autoscale apps cheaper on AWS Kubernetes than just using EC2 resources?

We're running like 100+ servers on AWS EC2 with like 20 microservices all load balanced and autoscaled with 2 to 3 instances. The cost has become....very significant. I'm wondering if migrating ...
3
votes
1answer
49 views

How to track (non ECS) container costs on EC2?

I've been evaluating Netflix Ice - as a billing tool - but it appears to only work at the Machine instance level - not at the container level. I'm looking for a tool to help generate billing reports ...
3
votes
2answers
1k views

What is the best way to find the Auto Scaling Group of an ECS cluster?

We are looking to inspect the ASG EC2 CloudWatch metrics such as CPU and Memory, since it includes an aggregate of all the ASG instances. Given that we know the ECS cluster, or the ECS service name. ...
3
votes
1answer
1k views

How does using packer and terraform in a CD pipeline compare to docker images built from git?

At work we have a Go CD pipeline for producing docker images, and scheduling docker containers with rancher. This works quite well. You can commit a change to the Docker image in Git, the pipeline ...
3
votes
2answers
25 views

Install apache on awa ec2 from locally installed ansible server on my laptop

I would like to install apache2 remotely on aws ec2 instance from my locally installed ansible server on my laptop. I have also the. pem key of the instance. Now what Ip need to put in /etc/ansible/...