5

I need to update the version of my lambda function in API Gateway with boto3, test:3 to test:4.

description

From what I understood, I would need to use the update_integration() function in boto3 and update with patchOperations, but I don't understand how as there isn't a lot of documentation about it.

client = boto3.client(
    'apigateway', 
    aws_access_key_id='access_key',
    aws_secret_access_key='secret_key',
    region_name = 'us-east-1'
)
response = client.update_integration(...) # something here?

Any suggestion?

------- EDIT -------

arn = 'arn:aws:apigateway:us-east-1:lambda:path/2015-03- 
31/functions/{lambdaFunctionArn}'

response = client.update_integration(
    restApiId= '{restApiId}',
    resourceId= '{resourceId}',
    httpMethod='POST',
    patchOperations=[
        {
            'op': 'replace',
            'path': '/uri',
            'value': arn
        }
    ]
)

I found that solution on this forum: https://forums.aws.amazon.com/thread.jspa?messageID=694264&#694264 but I keep getting this error:

botocore.errorfactory.BadRequestException: An error occurred (BadRequestException) when calling the UpdateIntegration operation: Role ARN must be specified for AWS integrations

1 Answer 1

3

I found the solution. I should have added /invocations at the end of arn:

arn = 'arn:aws:apigateway:us-east-1:lambda:path/2015-03- 
31/functions/{lambdaFunctionArn}/invocations'

response = client.update_integration(
    restApiId= '{restApiId}',
    resourceId= '{resourceId}',
    httpMethod='POST',
    patchOperations=[
        {
            'op': 'replace',
            'path': '/uri',
            'value': arn
        }
    ]
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.