Questions tagged with Amazon EC2
Content language: English
Sort by most recent
Is there a way to know if number of Load Balancer's backend changed?
I frequently run below script to get actual IP addresses of ec2 instances working as a Load balancer's backend. ``` TG_ELEMENTS=`aws elbv2 describe-target-health --target-group-arn $TG_ARN --query 'TargetHealthDescriptions[*].Target.Id' --profile $PROFILE` for i in $TG_ELEMENTS ; do aws ec2 describe-instances --instance-id $i --query 'Reservations.Instances.PrivateIpAddress' --profile $PROFILE done ``` Mostly returned TG_ELEMENTS list is the same (scalling is not so frequent). I was wondering if there is a way to do some small query to know if target group / load balancer's backend change, and if so do some extra queries to get these IP address list?
Setting up digest authentication
Hi, I'm trying to configure a HTTP digest auth on ec2. I create username and pwd by htdigest and set up authentication in both .htaccess and /etc/httpd/conf/httpd.conf by the following. <Directory "/var/www/html"> AllowOverride All AuthType Digest AuthName "Digest Auth" AuthDigestDomain /var/www/html/secret/ AuthUserFile "/etc/httpd/conf/.digestpass" Require valid-user </Directory> But no authentication is successfully set up as I reload the /secret page. Am I missing anything? Any help would be appreciated!
EC2 Connection Problem
Earlier this year I switched my RDS database from EC2-Classic to a VPC. While I've been able to read/write to the database through my Localhost connection, I am now in the process of replacing my old EC2 connections (I haven't been hosting a web app, but have used EC2 in the past when I've needed to run long and potentially slow PHP scripts). It took a couple of tries, but I finally created a Linux EC2 instance that went through the VPC and I was able to connect via WinSCP and Putty. I changed the file permissions and transferred my code over. I tried to reconnect via Putty and am getting a "Network error: Connection refused" message. When I try to login to WinSCP, I'm getting a "Network Error Connection to ---- Refused." I tried stopping and restarting my EC2 connection and using the new public IP address and I'm getting the same errors. What do you think changed so that I can no longer access this connection? Should I just try the whole process again from the start?
How to package and automate License software and do versioning based on License software or free software in Windows Ec2 instance with AWS?
How to package and automate License software and do versioning based on License software or free software in Windows Ec2 instance with AWS? **Tools Example** like: AWS Image Builder, HASI Corp Packer. I see very less example on Windows Instance on License software Packaging and versioning. ******Please advise****.** with Step by step documents and videos. **Reference Link**: **Packer**: https://developer.hashicorp.com/packer/tutorials/integrations/aws-windows-image **AWS Image Builder:- ** https://aws.amazon.com/image-builder/
IP Address Assigned to EC2 Instance
Two questions: 1) When an EC2 instance is started, what actually provides the IP addresses that are assigned to it? 2) How can I see the public IP address assigned to an EC2 instance, from within (i.e. after connecting) the EC2 instance? When an EC2 is started, I can see the public IP address that is assigned to it, simply by looking in the Management Console. I can also see the Private IP assigned to that same EC2 instance, once I connect to it, and issue the "ip a s" command - I'm running a RHEL OS. Is there a command that I can run/execute within Linux that will display the public IP address associated with that EC2 instance?
Issue in the installation of the AWS CodeDeploy Agent in EC2 instance with AMI - Ubuntu Server 22.04 LTS
have created an Amazon EC2 instance with AMI - Ubuntu Server 22.04 LTS (Free Tier) and try to install AWS CodeDeploy Agent into it. I am following the official documentation from Amazon to install CodeDeploy agent into the Ubuntu server. [https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install-ubuntu.html](AWS Documentation Link) I have connected the EC2 instance with SSH Keypairs and run the following commands: ``` sudo apt update sudo apt install ruby-full sudo apt install wget wget https://aws-codedeploy-ap-south-1.s3.ap-south-1.amazonaws.com/latest/install chmod +x ./install sudo ./install auto ``` In the last command, I got the following error message: ``` I, [2022-11-25T20:22:45.262298 #4303] INFO -- : Starting Ruby version check. E, [2022-11-25T20:22:45.262740 #4303] ERROR -- :Current running Ruby version for root is 3.0.2, but Ruby version 2.x needs to be installed. E, [2022-11-25T20:22:45.262959 #4303] ERROR -- : If you already have the proper Ruby version installed, please either create a symlink to /usr/bin/ruby2.x, E, [2022-11-25T20:22:45.263173 #4303] ERROR -- : or run this install script with right interpreter. Otherwise please install Ruby 2.x for root user. E, [2022-11-25T20:22:45.263378 #4303] ERROR -- : You can get more information by running the script with --help option. ``` Please let me know if there is any other hacks, I should employ to install AWS CodeDeploy agent in the EC2 instance with with AMI - Ubuntu Server 22.04 LTS (Free Tier). Thanks in advance!!
Code Deploy Stuck for 30 mins on afterInstall hook
So, I set up bitbucket pipelines this morning for a wordpress-php website. I have a afterInstall script which changes the permissions & user of wordpress directories etc. The problem is when the deployment starts, it took only 9 seconds for install step. but on afterInstall step, the code deploy stuck for nearly 30 mins, and then it reached to last step. and when the deployment ends, on bitbucket it says Failed, but my latest code is successfully deployed on servers. my zip folder is of 138MB Why the code deploy process stucks at afterInstall. there is nothing showing up in code deploy logs of that specific ec2 instance on which deployment is running.
EC2 Snapshot attaches to SQL Server License
Good day, I have an EC2 instance that was launched using Ubuntu 20 with SQL Server Standard. It was supposed to be launched as Ubuntu 20 WITHOUT SQL. We reached out to AWS support and resolved this by uninstalling the SQL Server software and created a snapshot, which we used to launch an instance without the license attached to it. Now, we have launched another instance from a new snapshot from the new instance and the new instance comes up with the SQL Server Standard license and we have been billed for this license. Please help!
Has anyone ever recovered a randomly-assigned non-Elastic IP address?
I had a terrible thing happen this evening. One of my EC2 instances that had a randomly-assigned non-Elastic IP address was retired due to a hardware issue, and therefore I lost access to that IP address. Unfortunately that IP was a critical IP to my organization. I run an email platform and that IP was used in our customers' email campaigns to track link clicks. I should have never architected it this way -- my mistake -- but I'm now pleading with AWS support to give me that IP back. Wondering if anyone has ever been in a similar situation and gotten this resolved.
SSH connection from my local terminal to EC2 ubuntu instance is timed out.
Hello, I created an EC2 ubuntu instance and connect that instance through SSH from my local command prompt and connection was successfully. After sometime i close my terminal, reopen my local terminal again and try to connect the same instance but this time it gives timed out error. if i create new instance and connect to it it connects successfully. Mean each instance is connected through ssh connection only once. if i close connection and try to reconnect it gives timed out error. I set the security rule to permit SSH connection from anywhere. Can you please help me in this regard thank you.