0

Looking at the boto3 authentication scheme it seems like it uses a configuration file based authentication approach.

This link suggests that to authenticate with Lambda you can simply upload your code (zipped) after installing boto3 locally. Running python with boto2 as an AWS Lambda function

I was hoping there was something simpler I could do from within the aws lambda web interface to log in.

This is the code I'm running which returns "An error occurred (AccessDeniedException) when calling the GetFunction operation"

import json
import boto3

def lambda_handler(event, context):
    
    client = boto3.client('lambda',region_name='us-east-2') 
    response = client.get_function(FunctionName='jims_first_function')
    return {
        'statusCode': 200,
        'body': json.dumps(response)
    }
Jimbo
  • 2,886
  • 2
  • 29
  • 45

1 Answers1

0

I tried manually creating the .aws directory and associated credentials in the root directory and that failed. Not sure if that was because it wasn't in the /opt directory or not.

https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html#configuration

However after a bit more digging I found this link: How should I pass my s3 credentials to Python lambda function on AWS?

Basically it indicated that I needed to be digging around the permissions tab to modify policies associated with the default role. Clicking on the role brings up the IAM policy management window. In there I clicked on "Attach Policies", selected the AWSLambda_FullAccess option, and added it (that might be overkill, not sure). I might have needed to redeploy the code, not sure. After testing everything works.

Jimbo
  • 2,886
  • 2
  • 29
  • 45