Skip to content
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

Fix BackendDict instantiation service names #7723

Merged

Conversation

viren-nadkarni
Copy link
Contributor

@viren-nadkarni viren-nadkarni commented May 28, 2024

This PR updates certain BackendDict initialisations so that they use proper Botocore service name.

Earlier, these services used ec2 or lambda since boto3.Session().get_available_regions(...) used to return an empty list.

There are still a few instantiations remaining that were not updated for the above reason, these are:

  • redshiftdata should use redshift-data
  • apigatewaymanagementapi should use apigatewaymanagementapi
  • bedrockagent
  • ec2instanceconnect should use ec2-instance-connect

@viren-nadkarni viren-nadkarni changed the title Fix BackendDict service names Fix BackendDict instantiation service names May 28, 2024
@viren-nadkarni viren-nadkarni marked this pull request as ready for review May 28, 2024 11:41
@bblommers bblommers added the moto-core PR's that touch the core functionality. This will trigger additional tests. label May 28, 2024
@bblommers
Copy link
Collaborator

Hi @viren-nadkarni!

boto3.Session().get_available_regions(...) used to return an empty list

Do you know from which version of boto3 this changed? If this only happened in a recent version, then people that are stuck on an older version of boto3 will suddenly have an empty region-list, so they will no longer be able to use Moto - and that worries me a bit.

What is the effect (on LS) of changing these names?

@viren-nadkarni
Copy link
Contributor Author

@bblommers This has been out in Boto for quite a while. We made this change in LocalStack in July 2023, see localstack#68

Also related #6446

@viren-nadkarni
Copy link
Contributor Author

viren-nadkarni commented May 29, 2024

For the new iot-data change, I tested Boto3 1.20.0 (Nov 2021). It was working back then:

...
Successfully installed boto3-1.20.0 botocore-1.23.54 jmespath-0.10.0 python-dateutil-2.9.0.post0 s3transfer-0.5.2 six-1.16.0 urllib3-1.26.18

$ py
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto3
>>> boto3.session.Session().get_available_regions('signer')
[]
>>> boto3.session.Session().get_available_regions('iot-data')
['ap-east-1', 'ap-northeast-1', 'ap-northeast-2', 'ap-south-1', 'ap-southeast-1', 'ap-southeast-2', 'ca-central-1', 'eu-central-1', 'eu-north-1', 'eu-west-1', 'eu-west-2', 'eu-west-3', 'me-south-1', 'sa-east-1'
, 'us-east-1', 'us-east-2', 'us-west-1', 'us-west-2']

Edit: for signer it started working around 1.26.0 (Nov 2022)

Edit 2: LocalStack uses this value in the state restoration mechanism to identify the service to which a given backend belongs to.

Copy link
Collaborator

@bblommers bblommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that should be fine then. Thank you @viren-nadkarni!

@bblommers bblommers added this to the 5.0.9 milestone May 29, 2024
@bblommers bblommers merged commit 1bd6b31 into getmoto:master May 29, 2024
75 checks passed
Copy link
Contributor

This is now part of moto >= 5.0.9.dev4

jfmainville pushed a commit to jfmainville/moto that referenced this pull request Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
moto-core PR's that touch the core functionality. This will trigger additional tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants