I am building a python flask-Mysql app. I am building it using AWS cloud9. But When I run the code I am geting MYSQL_HOST key error. I am attaching code below. Is it because of the installation fault or code error.?` ` Answer You are calling application = Flask(__name__) twice. So second time you are overwriting the first application. It
Tag: amazon-web-services
How do I get a download link for an object I upload to an AWS bucket?
I’m using AWS S3 boto3 to upload files to my AWS bucket called uploadtesting. Here is an example implementation: Accessing the object from the AWS S3 console allows you to see the object URL, however it is not a downloadable link. What I wanted to know is how can I use python to print out a downloadable link to the
Getting KeyError when trying to access key in a dictionary
I’m using Boto3 of AWS to describe the security group and trying to access the FromPort key for all the security groups available in a particular region. But when I’m trying to do so it will list some of the ports and then throws the KeyError. Code: Output: Answer Your code is assuming that the entry you are trying to
How to get multiple sentences in arrays into a single response in python?
As a hobby, I started doing a project with amazon textract which helps in extracting text from a photo or a pdf. Now I ran into a problem. According to what I read from it’s docs, every word in the photo is a small “block”. When I try printing, it prints fine, but if I have to use that text
AWS Python socket client TimeoutError: [WinError 10060] A connection attempt failed
I have an aws ec2 instance where I am trying to create a server to bind with my windows application the ser works but whenever I try to connect to the server from the client on my pc it gives the following error: Server.py Client.py The client code is running on my windows pc and the Server code is running
AWS s3, lambda. How do you download image from tmp that has a prefix?
I am currently learning AWS, mostly s3 and lambda services. The idea is to save an image in one bucket, resize it and move to another bucket. I have searched for dozen tutorials and finally made it work. However, I have not found(or don`t know how to search) for an example of how to deal with images with prefixes. This
AWS S3 Multi-Part Unable to resume
I am implementing AWS S3 multipart using python boto3. I am unable to resume the pending uploads. How to get the pending parts to resume. print(response[‘Parts’]) KeyError: ‘Parts’ Answer I think after create_multipart_upload, you have to start upload using: https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html
How to make connection from Aws Glue Catalog tables to custom python shell script?
I have some tables in aws glue data catalog which have been created by crawling the data from S3 buckets.I am writing my own python shell script to perform some data trasformations for data in those tables.But how can I make the connection to those tables in data catalog via python script? Answer If you want to access Glue catalog
Airflow/EC2 – Save CSV from DAG
I was looking around but I could not find anyone that may have a similar issue. I’m trying to save some results to a CSV into my EC2 instance, but for some reason the return value is none. Here is what I have: I have to get this output in a CSV and therefore the use of Pandas. This is
How to upload pandas, sqlalchemy package in lambda to avoid error “Unable to import module ‘lambda_function’: No module named ‘importlib_metadata'”?
I’m trying to upload a deployment package to my AWS lambda function following the article https://korniichuk.medium.com/lambda-with-pandas-fd81aa2ff25e. My final zip file is as follows: https://drive.google.com/file/d/1NLjvf_-Ks50E8z53DJezHtx7-ZRmwwBM/view but when I run my lambda function I get the error Unable to import module ‘lambda_function’: No module named ‘importlib_metadata’ My handler is named lambda_function.lambda_handler which is the file name and the function to run. I