:doc:`EC2 <../../ec2>` / Resource / ServiceResource

================
Service Resource
================



.. note::

  Before using anything on this page, please refer to the resources :doc:`user guide <../../../../guide/resources>` for the most recent guidance on using resources.



.. py:class:: EC2.ServiceResource()

  A resource representing Amazon Elastic Compute Cloud (EC2)::

    
    import boto3
    
    ec2 = boto3.resource('ec2')

  




-------
Actions
-------



Actions call operations on resources.  They may automatically handle the passing in of arguments set from identifiers and some attributes.
For more information about actions refer to the :ref:`Resources Introduction Guide<actions_intro>`.

These are the resource's available actions:

.. toctree::
  :maxdepth: 1
  :titlesonly:

  create_dhcp_options
  create_instances
  create_internet_gateway
  create_key_pair
  create_network_acl
  create_network_interface
  create_placement_group
  create_route_table
  create_security_group
  create_snapshot
  create_subnet
  create_tags
  create_volume
  create_vpc
  create_vpc_peering_connection
  disassociate_route_table
  get_available_subresources
  import_key_pair
  register_image



-------------
Sub-resources
-------------



Sub-resources are methods that create a new instance of a child resource. This resource's identifiers get passed along to the child.
For more information about sub-resources refer to the :ref:`Resources Introduction Guide<subresources_intro>`.

These are the resource's available sub-resources:

.. toctree::
  :maxdepth: 1
  :titlesonly:

  ClassicAddress
  DhcpOptions
  Image
  Instance
  InternetGateway
  KeyPair
  NetworkAcl
  NetworkInterface
  NetworkInterfaceAssociation
  PlacementGroup
  Route
  RouteTable
  RouteTableAssociation
  SecurityGroup
  Snapshot
  Subnet
  Tag
  Volume
  Vpc
  VpcAddress
  VpcPeeringConnection



-----------
Collections
-----------



Collections provide an interface to iterate over and manipulate groups of resources. 
For more information about collections refer to the :ref:`Resources Introduction Guide<guide_collections>`.

These are the resource's available collections:

.. toctree::
  :maxdepth: 1
  :titlesonly:

  classic_addresses
  dhcp_options_sets
  images
  instances
  internet_gateways
  key_pairs
  network_acls
  network_interfaces
  placement_groups
  route_tables
  security_groups
  snapshots
  subnets
  volumes
  vpc_addresses
  vpc_peering_connections
  vpcs
