Closed benbenz closed 1 year ago
Hi @benbenz - thanks for reaching out.
It looks like there's already open issue here and as mentioned in a comment there, we do have a backlog item to investigate and will need a deep dive.
Also to share the brief background, there are two return types for EC2 operations, with unfortunately similar names. These are generated from the resource file in Boto3. We will need to look into the resource model.
Additionally, the boto3 team has recently announced that the Resource interface has entered a feature freeze and won’t be accepting new changes at this time: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/resources.html. We’ll be closing existing feature requests, such as this issue, to avoid any confusion on current implementation status. We do appreciate your feedback and will ensure it’s considered in future feature decisions.
We’d like to highlight that all existing code using resources is supported and will continue to work in Boto3. No action is needed from users of the library.
Since this is considered a duplicate of https://github.com/boto/boto3/issues/3472, I'm going to close this in favor of that issue. Please follow up on there for updates going forward.
Best, John
Thank you for your answer. And apologies for not finding the duplicate. I had seen a similar one but that one was closed. I was using the resource feature just for this action (fetching the key_material) so it is not a problem to deprecate it for me. That said, will there be a ec2 client method that allows to retrieve the private key?
Describe the bug
Hello,
I am trying to retrieve the key_material of a KeyPair object but when I instantiate the KeyPair with ec2.resources, I get a KeyPairInfo back (which doesn't have the key_material attribute). Could you please let me know what I could be doing wrong. I am using an AWS profile.
keypair_name = 'mykeypair' ec2 = session.resource('ec2') key_pair = ec2.KeyPair(keypair_name) # same with boto3.resource('ec2').KeyPair(keypair_name)
I am using boto3 version 1.26.41
Expected Behavior
returns ec2.KeyPair
Current Behavior
returns ec2.KeyPairInfo
Reproduction Steps
import boto3
keypair_name = 'existing-keypair-name' key_pair = boto3.resource('ec2').KeyPair(keypair_name) print(key_pair) print(key_pair.key_pair_id)
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.26.41
Environment details (OS name and version, etc.)
OSX 10.9 + Python 3.9