-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to execute Pricing.Client.list_price_lists in AWS Lambda #4255
Comments
Thanks for reaching out. I tested this both locally and in Lambda and it ran successfully: from datetime import datetime
import boto3
print(boto3.__version__)
client = boto3.client('pricing', region_name='us-east-1')
response = client.list_price_lists(
ServiceCode='AmazonEC2',
EffectiveDate=datetime(2024, 1, 1),
RegionCode='us-east-1',
CurrencyCode='USD'
)
print(response) Can you provide a code snippet for reproducing the issue? What error do you get when running the command in Lambda? Does your Lambda execution role have |
Hi Tim, Thank you for the quick response. Below is my code:
This is the error message:
I also called the describe_services API and that worked. Also made sure that Lambda execution role has the ListPriceLists permission. Thanks! |
Thanks for following up — can you verify your Boto3/Botocore versions in your Lambda function? For example: import boto3
import botocore
print(boto3.__version__)
print(botocore.__version__) For the ListPriceLists Pricing API it looks like you need at least Boto3 1.26.82 and Botocore 1.29.82. Are you using Boto3/Botocore versions in your Lambda that are older than those? Your code above works for me in Lambda, and I'm using the default Python 3.11 runtime which currently has version |
Thanks Tim! It's resolved now. My Python version was outdated in Lambda, which was causing the issue. |
Glad it's working now! I'll go ahead and close the issue. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the issue
Hi, Is this issue due to "This feature is in preview release and is subject to change" according to this documentation? I am able to execute this command in Jupyter Notebook, but unable to do so in Lambda. Thank you for answering my question!
Links
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/pricing/client/list_price_lists.html#Pricing.Client.list_price_lists
The text was updated successfully, but these errors were encountered: