I have learned that boto3 offers two levels of abstraction: a low-level API called client that is a thin wrapper around the AWS HTTP API, and a high-level client called resource that offers real Python objects. My question is, where is the API documentation for the resource API?
I found this:
https://boto3.readthedocs.io/en/stable/reference/services/ec2.html#client
But that describes the client API, and there's not a 1-to-1 mapping to the resource API. For example, enumerating instances is called describe_instances() on the client object, and it is called instances.all() on the resource object.
Next I found this:
http://boto3.readthedocs.io/en/stable/reference/core/resources.html?highlight=resource
This describes a set of base classes and factory methods, but it doesn't describe the API for a specific service like EC2.
At runtime, I printed out an object of interest and found that it is a boto3.resources.factory.ec2.ServiceResource, but searching the boto3 documentation doesn't show me any human-readable documentation for this resource.
Is there an API document that explains what all of the different Python classes are, and what properties/methods they have? I can print this out at runtime, e.g. print(dir(ec2)) but this is a pretty tedious way to discover the API.
Thanks @jordanm for answering in the comments. I'm expanding into a more detailed answer.
The client documentation contains a section called "Service Resource" that I had not noticed before.
Highlighted the service resource in the table of contents:

Clicking this heading shows me the methods and properties of an EC2 resource instance.

Hope this answer is useful to some even though its late.
Use these two links accordingly
Consider the 1st one as the Main reference. This is the link provided in the other answer https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#service-resource
Main reference
The 2nd one provides a more detailed view on the methods and attributes available for a particular resource like instance,image,VPC etc
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html
^this is almost the same link -- all options below the service-resource provide detailed info on that particular resource such as instance,image etc.,
common resources
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With