boto3

boto3 : SSM Parameter get_parameters()

boto3 : SSM Parameter get_parameters() Question: I am creating lambda function where I am fetching SSM parameter for EKS-Optimized AMI ID, now about EKS-Optimized AMI, it is the default AMI provided by EKS if we are not specifying any AMI explicitly. EKS-Optimized AMI are different per region & K8 version. I am working on upgrading …

Total answers: 2

How can I help scale an Elasticache (redis) set up with Lambda (SDK)?

How can I help scale an Elasticache (redis) set up with Lambda (SDK)? Question: I’m implementing a solution that basically involves a Redis high/low CPU Utilization –> (CW Alarm goes off) –> EventBridge Event –> Triggers Lambda –> Lambda scales in Redis I want this Lambda to check the the number of shards currently being …

Total answers: 1

Dynamodb query using FilterExpression involving nested attributes with boto3

Dynamodb query using FilterExpression involving nested attributes with boto3 Question: I have below data in my dynamodb table with name as partition-key. { "name":"some-name", "age": 30, "addresses":[ "addr-1", "addr-2" ], "status":"active" } I have a GSI defined with partition-key on status field. Now, I have to run a query which returns all records whose status …

Total answers: 1

Python – Reset BytesIO So Next File Isn't Appended

Python – Reset BytesIO So Next File Isn't Appended Question: I’m having a problem with BytesIO library in Python. I want to convert a pdf file that I have retrieved from an S3 bucket, and convert it into a dataframe using a custom function convert_bytes_to_df. The first pdf file is fine to convert to a …

Total answers: 1

How to concatenate Boto3 filter expression?

How to concatenate Boto3 filter expression? Question: I would like to dynamically create Boto3 filter expression. My goal is to make tool to fetch easily data from DynamoDb with most used filters. I’m trying to store filter expressions in list and then combine them to one expression. So, if I have this list: list_of_expressions = …

Total answers: 2

botot3 with sqs: the address 'QueueUrl' is not valid for this endpoint

botot3 with sqs: the address 'QueueUrl' is not valid for this endpoint Question: I am trying to the get queue url from a SQS queue. I have read about other posts Set the endpoint for boto3 SQS and boto3 sqs incorrect url when not specified endpoint url but it is still puzzling why the code …

Total answers: 1

Update record in DynamoDB for reserved Keyword

Update record in DynamoDB for reserved Keyword Question: Following data mapped in DynamoDB for record_id 7, I want to update customer with new value "customer": { "value": "id2", "label": "Customer2" } However, dyanamoDB does not allow to update because of "ValidationException: Invalid UpdateExpression: Attribute name is a reserved keyword; reserved keyword: value". Record in DynamoDB: …

Total answers: 2

Invalid UpdateExpression: Attribute name is a reserved keyword; reserved keyword: value

Invalid UpdateExpression: Attribute name is a reserved keyword; reserved keyword: value Question: I am trying to update the record in dynamodb using following dictData, I have RESERVER_KEYWORDS array which has reserved keyword in dynamoDB. Please check code segment which I am trying to replace with the reserve keyword. Main issue that customer.value and action.value type …

Total answers: 1

AttributeError: 'dict' object has no attribute 'Instance' python

AttributeError: 'dict' object has no attribute 'Instance' python Question: i am trying to start the EC2 Instance with PrivateIP where i provide as argument "PrivateIP" and below code will describe the ec2 and get InstanceId. Once InstanceId received, it starts the EC2 instance def status_ec2_instance(instanceIds_list, region_Name): ec2 = boto3.resource(‘ec2’, region_name=region_Name) ec2_client = boto3.client(‘ec2’, region_name=region_Name) print(instanceIds_list) …

Total answers: 1

Get all File from Subfolder Boto3

Get all File from Subfolder Boto3 Question: I have this code to download all the files from a buckets AWS S3 import os import boto3 #initiate s3 resource s3 = boto3.resource(‘s3’) s3 = boto3.resource( ‘s3’, aws_access_key_id = ‘__________’, aws_secret_access_key = ‘________’, region_name = ‘______’ ) # select bucket my_bucket = s3.Bucket(‘MainBucket’) # download file into …

Total answers: 1