Questions tagged with Amazon EC2
Content language: English
Sort by most recent
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.
Debian-11 build process has lost its ethernet interfaces
We are using Yocto build-system (kirkstone) to compile images for i.MX8 based development board and we are trying to move the build process to AWS EC2 based environment for CI integration. We are currently using Debian (AMI: debian-11-amd64-20220503-998, type: t3.2xlarge) EC2 image from AWS marketplace. We have configured the EC2 machine with one external interface that binds to public IP and the machine is able to communicate with the outside world. This is the output of the `ip addr` from the login shell ``` admin@ip-XXX-XXX-XXX-XXX:~$ ip a show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc mq state UP group default qlen 1000 link/ether XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff altname enp0s5 inet XXX-XXX-XXX-XXX/20 brd XXX.XXX.XXX.XXX scope global dynamic ens5 valid_lft 2992sec preferred_lft 2992sec inet6 XXXX::XXXX:XXXX:XXXX:XXXX/64 scope link valid_lft forever preferred_lft forever ``` But, after we try to compile our Yocto project we get several build errors due to fetch failing as some of our recipes fail to fetch sources from outside world. If I launch a development shell with `bitbake -c devshell my-app` it will no longer see the ethernet devices but only the local interface which is in down state and has no IP attached to it ``` admin@ip-XXX-XXX-XXX-XXX:~/yocto/build/tmp/work/x86_64-linux/my-app/1.0.0-r0/my-app-1.0.0$ ip a show 1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:200:00:00:00 ``` and I can also see that resolving outside connections no longer work ``` admin@ip-XXX-XXX-XXX-XXX:~/yocto/build/tmp/work/x86_64-linux/my-app/1.0.0-r0/my-app-1.0.0$ traceroute6 www.google.com www.google.com: Temporary failure in name resolution Cannot handle "host" cmdline arg `www.google.com' on position 1 (argc 1) ``` This is the output from process tree ``` admin@ip-XXX-XXX-XXX-XXX:~/yocto/build/tmp/work/x86_64-linux/my-app/1.0.0-r0/my-app-1.0.0$ ps f PID TTY STAT TIME COMMAND 943 pts/1 Ss 0:00 /bin/bash 994 pts/1 R+ 0:00 \_ ps f 758 pts/0 Ss 0:00 -bash 830 pts/0 Sl+ 0:01 \_ python3 /home/admin/yocto/sources/poky/bitbake/bin/bitbake my-app -c devshell 941 pts/0 S+ 0:00 \_ sh -c screen -r devshell_939 942 pts/0 S+ 0:00 \_ screen -r devshell_939 ``` Another thing that seems off is that the build process has somehow lost all its groups and there is a group `nogroup` added ``` admin@ip-XXX-XXX-XXX-XXX:~/yocto/build/tmp/work/x86_64-linux/my-app/1.0.0-r0/my-app-1.0.0$ groups admin nogroup ``` When running the `groups` from the login shell the user has `admin adm dialout cdrom floppy sudo audio dip video plugdev netdev` that seem to be lost when launching the development shell. We are using the build system in multiple local development environments (based on Debian-11) and the build system is able to connect to outside world just fine so this relates to the AWS EC2 Debian image that we are using. Why are the interfaces not displayed and how can we work-around this issue so that the build process can access the source repositories from the build environment?
VirtualBox localhost "Login incorrect"
I am new to virtual machines, Linux and amazon so please bare with me. I have installed the virtual machine according to amazon's instructions listed [here](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-2-virtual-machine.html). I am able to boot in VirtualBox, but I am stuck on a sign in page that asks for: ``` localhost login: ``` rather than: ``` amazon login: ``` as I've seen others report. Now I have not made changes to the *meta-data *file in the ISO image, so all it says is: ``` local-hostname: amazon ``` with some additional commented lines regarding 'network-interfaces' that I am unfamiliar with. The server goes to "localhost" as a direct result of this, I guess? but I do not know the login for localhost and the users and passwords set in the *user-data* file do not work. If someone could point me in the right direction to set the proper network configuration or help with the credentials that would be greatly appreciated.
Not able to detach EBS Volume
Although the EBS volume is not attached to any EC2 instsances, it is still showing in-use. I tried force detach from aws console but it is stuck. Force detaching the volume from AWS CLI shows following error ``` An error occurred (InvalidParameterValue) when calling the DetachVolume operation: The volume ID 'vol-00402f84342cf78f' is malformed ```
Got regional data transfer usage between Lightsail and EC2 within the same region
Hi: I'm using VPC peering to connect my EC2 and Lightsail instance within the same region and AZ. The EC2 has no public IP address, but from the usage report, I found the EC2 somehow has regional data transfer usage with public IP. VPC log also shows no transfer to anywhere outside of the AZ, is there any possibility that some other AWS service could cause this issue? Thanks. ![EC2 instance](/media/postImages/original/IMXLRIKkwASqOyT388Y9FLjw) ![usage](/media/postImages/original/IM2oit7osLRSK_qpSjDEDM4A)
Launching EC2 instance failed in Auto Scaling Group
I have an autoscaling group, recently change to attribute based selection, and now have many errors: > Launching a new EC2 instance. Status Reason: Internal error. Launching EC2 instance failed. during attempts scale-outs. I can't find any more detail as to what the error is.
Show only selected servers in session manager
Hi, I am currently using session manager to provide access to all servers via session manager which is working as intended. The issue comes where I got another set of users who require access to certain servers. Is there anyway, only the servers that is required will be shown up in the session manager. I tried to edit the ec2:DescribeInstances but I just can't get it working. Would require assistance with this.