{"action":"created","issue":{"url":"https://api.github.com/repos/boto/boto3/issues/274","labels_url":"https://api.github.com/repos/boto/boto3/issues/274/labels{/name}","comments_url":"https://api.github.com/repos/boto/boto3/issues/274/comments","events_url":"https://api.github.com/repos/boto/boto3/issues/274/events","html_url":"https://github.com/boto/boto3/issues/274","id":108356324,"number":274,"title":"delete_key_pair is not available via the ec2 resource","user":{"login":"kislyuk","id":862013,"avatar_url":"https://avatars.githubusercontent.com/u/862013?v=3","gravatar_id":"","url":"https://api.github.com/users/kislyuk","html_url":"https://github.com/kislyuk","followers_url":"https://api.github.com/users/kislyuk/followers","following_url":"https://api.github.com/users/kislyuk/following{/other_user}","gists_url":"https://api.github.com/users/kislyuk/gists{/gist_id}","starred_url":"https://api.github.com/users/kislyuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kislyuk/subscriptions","organizations_url":"https://api.github.com/users/kislyuk/orgs","repos_url":"https://api.github.com/users/kislyuk/repos","events_url":"https://api.github.com/users/kislyuk/events{/privacy}","received_events_url":"https://api.github.com/users/kislyuk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-25T16:14:30Z","updated_at":"2015-09-25T19:45:43Z","closed_at":null,"body":"```\r\n>>> import boto3\r\n>>> boto3.ec2\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\nAttributeError: module 'boto3' has no attribute 'ec2'\r\n>>> boto3.resource('ec2').create_key_pair\r\n<bound method ResourceFactory._create_action.<locals>.do_action of ec2.ServiceResource()>\r\n>>> boto3.resource('ec2').delete_key_pair\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\nAttributeError: 'ec2.ServiceResource' object has no attribute 'delete_key_pair'\r\n>>> boto3.resource('ec2').meta.client.delete_key_pair\r\n<bound method ClientCreator._create_api_method.<locals>._api_call of <botocore.client.EC2 object at 0x104721b00>>\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/boto/boto3/issues/comments/143335249","html_url":"https://github.com/boto/boto3/issues/274#issuecomment-143335249","issue_url":"https://api.github.com/repos/boto/boto3/issues/274","id":143335249,"user":{"login":"kyleknap","id":4605355,"avatar_url":"https://avatars.githubusercontent.com/u/4605355?v=3","gravatar_id":"","url":"https://api.github.com/users/kyleknap","html_url":"https://github.com/kyleknap","followers_url":"https://api.github.com/users/kyleknap/followers","following_url":"https://api.github.com/users/kyleknap/following{/other_user}","gists_url":"https://api.github.com/users/kyleknap/gists{/gist_id}","starred_url":"https://api.github.com/users/kyleknap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyleknap/subscriptions","organizations_url":"https://api.github.com/users/kyleknap/orgs","repos_url":"https://api.github.com/users/kyleknap/repos","events_url":"https://api.github.com/users/kyleknap/events{/privacy}","received_events_url":"https://api.github.com/users/kyleknap/received_events","type":"User","site_admin":false},"created_at":"2015-09-25T19:45:43Z","updated_at":"2015-09-25T19:45:43Z","body":"So usually with the service resource, we typically only add operation that result in producing a new resource. Especially since ec2 has a lot of operations, this helps in discoverability of resources and functionality. To achieve the functionality that you are looking for using only the resource interface. You would have to first create the resource object and call its delete method. So something like this:\r\n```py\r\nIn [1]: import boto3\r\n\r\nIn [2]: ec2 = boto3.resource('ec2')\r\n\r\nIn [3]: keypair = ec2.KeyPair('mykeypair')  # Note that no data is loaded here. Just a python object is created\r\n\r\nIn [4]: keypair.delete\r\nOut[9]: <bound method ec2.KeyPair.delete of ec2.KeyPair(name='mykeypair')>\r\n```\r\n\r\nLet me know if you have any further questions or comments."}}