Category : aws-lambda

I am trying to mock describe_instance_types call on AWS EC2 client, using Python Stubber, but not successful. I have a lambda handler function, in which calling a function describe_instance_types() with instance_type as param to get the hypervisor information for it. describe_instance_types_response = boto3.client(‘ec2’).describe_instance_types(InstanceTypes=[instance_type]) hypervisor = describe_instance_types_response["InstanceTypes"][0]["Hypervisor"] And have a test case with stubber as below ..

Read more

I built a Sagemaker endpoint that I am attempting to evoke using Lambda+API Gateway. I’m getting the following error: "An error occurred (ModelError) when calling the InvokeEndpoint operation: Received client error (400) from model with message "unable to evaluate payload provided" I know why what it’s complaining about, but I don’t quite understand why it’s ..

Read more

I currently have this lambda function in python which calls a glue job: import boto3 client = boto3.client(‘glue’) glueJobName = "Python New sync" inputtedData = "123" school = "testing" def lambda_handler(event, context): response = client.start_job_run(JobName = glueJobName, Arguments = {‘–inputtedData’: inputtedData, ‘–school’: school}) return response However, I need the function to be in javascript. This ..

Read more

I am trying to run a copy command which loads around 100 GB of data from S3 to redshift. I am using the lambda function to initiate this copy command every day. This is my current code from datetime import datetime, timedelta import dateutil.tz import psycopg2 from config import * def lambda_handler(event, context): con = ..

Read more

I got error "errorMessage": "An error occurred (AccessDenied) when calling the DescribeClusters operation: User: arn:aws:sts::XX:assumed-role/xx/axx is not authorized to perform: redshift:DescribeClusters on resource: arn:aws:xx:*", For RDS below is the code client = boto3.client(‘rds’) cluster_list = client.describe_db_cluster_endpoints() print(cluster_list) For redshift below is the code client = boto3.client(‘redshift’, ‘us-east-2’) cluster_list = client.describe_clusters() print(cluster_list) My I am role ..

Read more

count of files in incoming directory returns Int ($files). if /monitering/.incomming-file-count does not exist. creates /monitering/.incomming-file-count with . exit elseif /monitering/.incomming-file-count exists read file. validate that file only has a single int in it. store value as var ($prev-count) compare value in file to file count if prev-count is greater to or equal to $count ..

Read more