aws-sdk

How to check if an ec2 instance is running or not with an if statement?

How to check if an ec2 instance is running or not with an if statement? Question: I have an instance-id of an ec2 instance. How to check if that ec2 instance is running or not using an if statement? I am using Python and Boto3. Asked By: jbot || Source Answers: Using the boto3 Resource …

Total answers: 3

How to get the region of the current user from boto?

How to get the region of the current user from boto? Question: Problem: I’m trying to get the region of the authenticated user from boto3. Use case: I’m working on adding cache to https://github.com/pmazurek/aws-fuzzy-finder. I would prefer to cache the result on per-region basis. This package uses boto to get user authentication data (keys and …

Total answers: 5

Using psycopg2 with Lambda to Update Redshift (Python)

Using psycopg2 with Lambda to Update Redshift (Python) Question: I am attempting to update Redshift from a Lambda function using python. To do this, I am attempting to combine 2 code fragments. Both fragments are functional when I run them separately. Updating Redshift from PyDev for Eclipse import psycopg2 conn_string = “dbname=’name’ port=’0000′ user=’name’ password=’pwd’ …

Total answers: 9

The role defined for the function cannot be assumed by Lambda

The role defined for the function cannot be assumed by Lambda Question: I’m getting the error “The role defined for the function cannot be assumed by Lambda” when I’m trying to create a lambda function with create-function command. aws lambda create-function –region us-west-2 –function-name HelloPython –zip-file fileb://hello_python.zip –role arn:aws:iam::my-acc-account-id:role/default –handler hello_python.my_handler –runtime python2.7 –timeout 15 …

Total answers: 11