Questions tagged with Amazon Linux

Content language: English

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

I'm trying to run an aws lightsail command, from within my Amazon Linux 1 instance, to update the caching settings on my distribution. When I first created the command it worked fine ... but after a while it stopped working and gave an "An HTTP Client raised an unhandled exception: 'module' object has no attribute 'raise_from'" error. I ran the command with the debug parm and got the output at the bottom of this post (partially, the full debug output won't fit in a post). Any suggestions? It seems I'm missing a python module, but don't know python at all (Java & RPG are my thing). Thanks! David 2022-12-09 07:44:33,646 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://lightsail.us-east-1.amazonaws.com/, headers={'Content-Length': '1118', 'X-Amz-Target': 'Lightsail_20161128.UpdateDistribution', 'X-Amz-Date': '20221209T134433Z', 'User-Agent': 'aws-cli/1.18.107 Python/2.7.18 Linux/4.14.248-129.473.amzn1.x86_64 botocore/1.17.31', 'Content-Type': 'application/x-amz-json-1.1', 'Authorization': 'AWS4-HMAC-SHA256 Credential=qqqqqqq/20221209/us-east-1/lightsail/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=xxxxxxxx'}> 2022-12-09 07:44:33,646 - MainThread - botocore.httpsession - DEBUG - Exception received when sending urllib3 HTTP request Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/botocore/httpsession.py", line 250, in send conn = manager.connection_from_url(request.url) File "/usr/lib/python2.7/dist-packages/urllib3/poolmanager.py", line 290, in connection_from_url u = parse_url(url) File "/usr/lib/python2.7/dist-packages/urllib3/util/url.py", line 392, in parse_url return six.raise_from(LocationParseError(source_url), None) AttributeError: 'module' object has no attribute 'raise_from' 2022-12-09 07:44:33,653 - MainThread - botocore.hooks - DEBUG - Event needs-retry.lightsail.UpdateDistribution: calling handler <botocore.retryhandler.RetryHandler object at 0x7fa41e1f5c90> 2022-12-09 07:44:33,653 - MainThread - awscli.clidriver - DEBUG - Exception caught in main() Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 217, in main return command_table[parsed_args.command](remaining, parsed_args) File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 358, in __call__ return command_table[parsed_args.operation](remaining, parsed_globals) File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 530, in __call__ call_parameters, parsed_globals) File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 650, in invoke client, operation_name, parameters, parsed_globals) File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 662, in _make_client_call **parameters) File "/usr/lib/python2.7/dist-packages/botocore/client.py", line 316, in _api_call return self._make_api_call(operation_name, kwargs) File "/usr/lib/python2.7/dist-packages/botocore/client.py", line 622, in _make_api_call operation_model, request_dict, request_context) File "/usr/lib/python2.7/dist-packages/botocore/client.py", line 641, in _make_request return self._endpoint.make_request(operation_model, request_dict) File "/usr/lib/python2.7/dist-packages/botocore/endpoint.py", line 102, in make_request return self._send_request(request_dict, operation_model) File "/usr/lib/python2.7/dist-packages/botocore/endpoint.py", line 137, in _send_request success_response, exception): File "/usr/lib/python2.7/dist-packages/botocore/endpoint.py", line 256, in _needs_retry caught_exception=caught_exception, request_dict=request_dict) File "/usr/lib/python2.7/dist-packages/botocore/hooks.py", line 356, in emit return self._emitter.emit(aliased_event_name, **kwargs) File "/usr/lib/python2.7/dist-packages/botocore/hooks.py", line 228, in emit return self._emit(event_name, kwargs) File "/usr/lib/python2.7/dist-packages/botocore/hooks.py", line 211, in _emit response = handler(**kwargs) File "/usr/lib/python2.7/dist-packages/botocore/retryhandler.py", line 183, in __call__ if self._checker(attempts, response, caught_exception): File "/usr/lib/python2.7/dist-packages/botocore/retryhandler.py", line 251, in __call__ caught_exception) File "/usr/lib/python2.7/dist-packages/botocore/retryhandler.py", line 269, in _should_retry return self._checker(attempt_number, response, caught_exception) File "/usr/lib/python2.7/dist-packages/botocore/retryhandler.py", line 317, in __call__ caught_exception) File "/usr/lib/python2.7/dist-packages/botocore/retryhandler.py", line 223, in __call__ attempt_number, caught_exception) File "/usr/lib/python2.7/dist-packages/botocore/retryhandler.py", line 359, in _check_caught_exception raise caught_exception HTTPClientError: An HTTP Client raised an unhandled exception: 'module' object has no attribute 'raise_from' 2022-12-09 07:44:33,660 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255 An HTTP Client raised an unhandled exception: 'module' object has no attribute 'raise_from'
1
answers
0
votes
37
views
profile picture
David G
asked 3 months ago
Hello, communit guys! I have a simple test.py Python script (see below) inside EC2 (t2.xlarge, Amazon Linux 2). I'm using VSCode to connect to EC2 for testing/debuging. When I run this code through VSCode or through linux terminal (`sudo python3 /home/ec2-user/tmp/test.py`) , this code runs until the end **But when I use the lambda to send the same execution command, after exactly 1 hour this code stops running (no python3 task running)! And I want it to keep running longer than 1 hour!** My objective is to send a command line to run my python script through lambda to EC2 and ensure that script run untill the end test.py ``` import logging from time import sleep logging.basicConfig(filename="/home/ec2-user/tmp/test.log", format='%(asctime)s %(message)s', filemode='w') logger = logging.getLogger() logger.setLevel(logging.INFO) var= True count = 0 while var==True: logger.info('=)') sleep(1) count+=1 if count>100000: var=False ``` lambda function ``` import json import boto3 comand_shell = 'sudo python3 /home/ec2-user/tmp/test.py' instance_id_ec2 = 'my_ec2_instance_id' def lambda_handler(event, context): client = boto3.client("ec2") ssm = boto3.client("ssm") try: describeInstance = client.describe_instances() for r in describeInstance['Reservations']: for inst in r['Instances']: if inst['InstanceId'] == instance_id_ec2: status = inst['State']['Name'] if status == 'running': response = ssm.send_command( InstanceIds=[instance_id_ec2], DocumentName="AWS-RunShellScript", Parameters={"commands": [comand_shell]}, ) print(f'{comand_shell } has sent to {instance_id_ec2} successfuly') else: print(f'Failed') except Exception as e: print("Unexpected Exception: %s" % str(e)) return None ``` First/last 5 lines' log file ``` 2022-12-21 00:39:48,379 =) 2022-12-21 00:39:49,381 =) 2022-12-21 00:39:50,382 =) 2022-12-21 00:39:51,383 =) 2022-12-21 00:39:52,385 =) ... ... ... 2022-12-21 01:39:30,908 =) 2022-12-21 01:39:31,765 =) 2022-12-21 01:39:32,302 =) 2022-12-21 01:39:33,286 =) 2022-12-21 01:39:34,853 =) ``` Thanks
1
answers
0
votes
154
views
Arita
asked 3 months ago
Currently supported PHP versions within amazon-linux-extras are either out of support or have fewer than 11 months left before their end of life. In order to enable developers ample time to upgrade applications, test and deploy, can we please get PHP 8.2 supported added as soon as possible? For reference, here are PHP's current versions and their support timelines: https://www.php.net/supported-versions.php There are also 3rd party packages (such as Bref) which use the amazon-linux-extras repos for compiling Lambda layers to allow PHP applications to run on ARM/Graviton: https://github.com/brefphp/bref/tree/v2/docs/runtimes#arm-runtimes
0
answers
8
votes
91
views
asked 3 months ago
Aloha, My goal is to have an EC2 instance in gov-cloud that is FIPS compliant to support a RHEL8 FIPS compliant container. I performed the following steps when creating and configuring the EC2 Instance. 1. Created a new instance (Launch Instances button from EC2 Dashboard) 2. Selected Amazon Linux 2 AMI (HVM) - Kernel 5.10, SSD Volume Type [64-bit (x86)] 3. Selected t2.mirco 4. Default "Configure Instance Details" 5. Storage size changed to 20 GiB - the rest of the settings were default 6. Configured the "Name" tag to be my project name 7. Default security group to allow SSH connections via TCP on port 22 8. Launched and downloaded the *.pem file 9. Connected to the machine as ec2-user using my personal machine's terminal via SSH and the *.pem file (login successful) 10. Performed the following commands: 11. `sudo yum update -y` 12. `sudo yum install -y dracut-fips` 13. `sudo dracut -f` 14. `sudo /sbin/grubby --update-kernel=ALL --args="fips=1"` 15. `sudo reboot` I allowed sufficient time for the system to reboot and attempted to login. I was met with the following message: `Permission denied (publickey,gssapi-keyex,gssapi-with-mic)`. I tried all methods available to connect to the instance and all methods failed. I have since terminated the instance. My questions: 1. Does it matter if the system is a dedicated host, dedicated instance, or shared instance when creating a FIPS compliant instance in gov-cloud? 2. Has anyone been successful in doing this? If so, what steps did you use or tutorial did you follow? 3. Any pointers or recommended solutions outside of using Amazon Linux 2? Thanks in advance, Craig
0
answers
0
votes
27
views
asked 3 months ago
I am trying to install Java 11 in Amazon Linux 2 docker image and trying to pass it as runtime for codebuild. Locally it has 750 MB after installation of Java 11 and when I upload it to ecr repo it's size is 300 MB. Is there a way to reduce it Below is my sample docker file FROM amazonlinux RUN yum update -y RUN amazon-linux-extras install java-openjdk11 -y
0
answers
0
votes
33
views
asked 4 months ago
I am creating a docker with amazon Linux 2 and installed the java 11 and passed it to my code build and getting error java path is not set. any suggestions to set path in Dockerfile
1
answers
0
votes
39
views
asked 4 months ago
Hello, I'm facing some complicated and un-thinking issue with Cloudwatch,I believe Cloudwatch are easy to use and install because i used to install it at others EC2 instance before. Unfortunately,but it doesn't happen this time.Might need your guys help for this issue. **The issue is:** -Cloudwatch unable to get the metric information from my EC2. **Troubleshooting i do as per below:** 1) Check config file: /etc/awslogs/awslogs.conf point to correct server - MyServer1 & /etc/awslogs/awscli.conf point to correct region = ap-southeast-1 **2)Following the step to re-install cloudwatch:** https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html **Stuck at because there's an error at the log.** "To install and configure CloudWatch Logs on an existing Amazon Linux instance" section, (Optional) Check the /var/log/awslogs.log file for errors logged when starting the service. The error as per below - /var/log/awslog.log: File "/usr/lib/python3.7/site-packages/awscli/plugin.py", line 58, in _import_plugins plugins.append(__import__(path)) ModuleNotFoundError: No module named 'cwlogs' **What i do is install** = pip install awscli-cwlogs But the issue still persist.Any steps that i missing?Please advice.
4
answers
0
votes
66
views
profile picture
Zeee
asked 4 months ago
I am unable to host a backend server on ec2 aws linux server can someone help me out with the right process?
0
answers
0
votes
27
views
asked 4 months ago
Hello everyone, I have a webapp on production and here are my configs: * OS is Amazon Linux 2 * Backend hosted in my EC2 with a CodeDeploy pipeline between AWS and Github * I have an elastic IP Address * Webapp has a website and a mobile app * Frontend is hosted in another EC2 instance * I have a script in my backend that does the automation of the build and deployment each time I push to GitHub I wanted to do some minor changes to my backend but I could not due to glibc as shown in the image bellow https://preview.redd.it/3wmkhably83a1.png?width=1537&format=png&auto=webp&s=7c1a34ef09598482dd628ed93715a6b5eddf6353 After research I found out that Amazon Linux 2 does not update the libraries that are needed by node as shown in this link: https://repost.aws/questions/QUrXOioL46RcCnFGyELJWKLw/glibc-2-27-on-amazon-linux-2 Now I am thinking of installing a new OS in my EC2 and I do not quite see all risks that might affect my clients. Any suggestions ?
0
answers
0
votes
33
views
asked 4 months ago
The "Comparing Amazon Linux 2 and Amazon Linux 2022" page at https://docs.aws.amazon.com/linux/al2022/ug/compare-al2-to-AL2022.html says: > Amazon Linux 2022 optimizes boot time to reduce the time from instance launch to running the customer workload. As such, this would be great for GameLift usage as it takes quite a while to launch instances in my experience. However, when using the AWS CLI to upload a build, the output for the "--operating-system" parameter only allows AMAZON_LINUX, AMAZON_LINUX_2 (and windows). Why is this? When will Amazon Linux 2022 be available with GameLift?
1
answers
0
votes
57
views
asked 4 months ago
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?
0
answers
0
votes
12
views
asked 4 months ago
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.
0
answers
0
votes
18
views
asked 4 months ago