{"action":"created","comment":{"url":"https://api.github.com/repos/boto/boto3/pulls/comments/27257432","id":27257432,"diff_hunk":"@@ -0,0 +1,164 @@\n+.. _guide_migration_s3:\n+\n+Amazon S3\n+=========\n+Boto 2.x contains a number of customizations to make working with Amazon S3 buckets and keys easy. Boto 3 exposes these same objects through its resources interface in a unified and consistent way.\n+\n+Creating the Connection\n+-----------------------\n+Boto 3 has both low-level clients and higher-level resources. For Amazon S3, the higher-level resources are the most similar to Boto 2.x's ``s3`` module::\n+\n+    # Boto 2.x\n+    import boto\n+    s3_connection = boto.connect_s3()\n+\n+    # Boto 3\n+    import boto3\n+    s3 = boto3.resource('s3')\n+\n+Creating a Bucket\n+-----------------\n+Creating a bucket in Boto 2 and Boto 3 is very similar, except that in Boto 3 all action parameters must be passed via keyword arguments and a bucket configuration must be specified manually::\n+\n+    # Boto 2.x\n+    s3_connection.create_bucket('mybucket')\n+    s3_connection.create_bucket('mybucket', location=Location.USWest)\n+\n+    # Boto 3\n+    s3.create_bucket(Bucket='mybucket')\n+    s3.create_bucket(Bucket='mybucket', CreateBucketConfiguration={\n+        'LocationConstraint': 'us-west-1'})\n+\n+Storing Data\n+------------\n+Storing data from a file, stream, or string is easy::\n+\n+    # Boto 2.x\n+    from boto.s3.key import Key\n+    key = Key('hello.txt')\n+    key.set_contents_from_file('/tmp/hello.txt')\n+\n+    # Boto 3\n+    s3.Key('mybucket', 'hello.txt').put(Body=open('/tmp/hello.txt'))\n+\n+\n+Accessing a Bucket\n+------------------\n+Getting a bucket is easy with Boto 3's resources, however these do not automatically validate whether a bucket exists::\n+\n+    # Boto 2.x\n+    bucket = s3_connection.get_bucket('mybucket', validate=False)\n+    exists = s3_connection.lookup('mybucket')\n+\n+    # Boto 3\n+    bucket = s3.Bucket('mybucket')\n+    bucket.wait_until_exists(max_attempts=2, service_args={'Foo': 1})","path":"docs/source/guide/migrations3.rst","position":55,"original_position":55,"commit_id":"f2c61832945dda2e054f3d7e5e53f5fd8c443405","original_commit_id":"f2c61832945dda2e054f3d7e5e53f5fd8c443405","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},"body":"What was the reason again you added the the wait for a max attempt of 2, when you now have the head_object based snipet to check to see if it exists again? Maybe a comment will help clear it up.","created_at":"2015-03-26T21:22:58Z","updated_at":"2015-03-26T21:22:58Z","html_url":"https://github.com/boto/boto3/pull/75#discussion_r27257432","pull_request_url":"https://api.github.com/repos/boto/boto3/pulls/75","_links":{"self":{"href":"https://api.github.com/repos/boto/boto3/pulls/comments/27257432"},"html":{"href":"https://github.com/boto/boto3/pull/75#discussion_r27257432"},"pull_request":{"href":"https://api.github.com/repos/boto/boto3/pulls/75"}}},"pull_request":{"url":"https://api.github.com/repos/boto/boto3/pulls/75","id":31867826,"html_url":"https://github.com/boto/boto3/pull/75","diff_url":"https://github.com/boto/boto3/pull/75.diff","patch_url":"https://github.com/boto/boto3/pull/75.patch","issue_url":"https://api.github.com/repos/boto/boto3/issues/75","number":75,"state":"open","locked":false,"title":"Add migration guide for S3 and EC2","user":{"login":"danielgtaylor","id":106826,"avatar_url":"https://avatars.githubusercontent.com/u/106826?v=3","gravatar_id":"","url":"https://api.github.com/users/danielgtaylor","html_url":"https://github.com/danielgtaylor","followers_url":"https://api.github.com/users/danielgtaylor/followers","following_url":"https://api.github.com/users/danielgtaylor/following{/other_user}","gists_url":"https://api.github.com/users/danielgtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/danielgtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielgtaylor/subscriptions","organizations_url":"https://api.github.com/users/danielgtaylor/orgs","repos_url":"https://api.github.com/users/danielgtaylor/repos","events_url":"https://api.github.com/users/danielgtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/danielgtaylor/received_events","type":"User","site_admin":false},"body":"An initial attempt at starting a migration guide. This covers:\r\n\r\n1. General changes between Boto 2 and 3\r\n2. An S3 migration guide\r\n3. An EC2 migration guide\r\n4. Moving the quickstart/tutorial into its own section before the migration guides\r\n\r\nThe migration guides are based on the Boto tutorials available on Read The Docs. It's likely we will want to add to them in the future but this sets up the basic framework and gives people a place to get started.\r\n\r\ncc @jamesls @kyleknap ","created_at":"2015-03-24T20:42:57Z","updated_at":"2015-03-26T21:22:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07b95223b300952445a00c91e0d14247c75a8662","assignee":{"login":"danielgtaylor","id":106826,"avatar_url":"https://avatars.githubusercontent.com/u/106826?v=3","gravatar_id":"","url":"https://api.github.com/users/danielgtaylor","html_url":"https://github.com/danielgtaylor","followers_url":"https://api.github.com/users/danielgtaylor/followers","following_url":"https://api.github.com/users/danielgtaylor/following{/other_user}","gists_url":"https://api.github.com/users/danielgtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/danielgtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielgtaylor/subscriptions","organizations_url":"https://api.github.com/users/danielgtaylor/orgs","repos_url":"https://api.github.com/users/danielgtaylor/repos","events_url":"https://api.github.com/users/danielgtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/danielgtaylor/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/boto/boto3/pulls/75/commits","review_comments_url":"https://api.github.com/repos/boto/boto3/pulls/75/comments","review_comment_url":"https://api.github.com/repos/boto/boto3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/boto/boto3/issues/75/comments","statuses_url":"https://api.github.com/repos/boto/boto3/statuses/f2c61832945dda2e054f3d7e5e53f5fd8c443405","head":{"label":"boto:migration-guide","ref":"migration-guide","sha":"f2c61832945dda2e054f3d7e5e53f5fd8c443405","user":{"login":"boto","id":327752,"avatar_url":"https://avatars.githubusercontent.com/u/327752?v=3","gravatar_id":"","url":"https://api.github.com/users/boto","html_url":"https://github.com/boto","followers_url":"https://api.github.com/users/boto/followers","following_url":"https://api.github.com/users/boto/following{/other_user}","gists_url":"https://api.github.com/users/boto/gists{/gist_id}","starred_url":"https://api.github.com/users/boto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boto/subscriptions","organizations_url":"https://api.github.com/users/boto/orgs","repos_url":"https://api.github.com/users/boto/repos","events_url":"https://api.github.com/users/boto/events{/privacy}","received_events_url":"https://api.github.com/users/boto/received_events","type":"Organization","site_admin":false},"repo":{"id":24774658,"name":"boto3","full_name":"boto/boto3","owner":{"login":"boto","id":327752,"avatar_url":"https://avatars.githubusercontent.com/u/327752?v=3","gravatar_id":"","url":"https://api.github.com/users/boto","html_url":"https://github.com/boto","followers_url":"https://api.github.com/users/boto/followers","following_url":"https://api.github.com/users/boto/following{/other_user}","gists_url":"https://api.github.com/users/boto/gists{/gist_id}","starred_url":"https://api.github.com/users/boto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boto/subscriptions","organizations_url":"https://api.github.com/users/boto/orgs","repos_url":"https://api.github.com/users/boto/repos","events_url":"https://api.github.com/users/boto/events{/privacy}","received_events_url":"https://api.github.com/users/boto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/boto/boto3","description":"**Developer Preview** AWS SDK for Python","fork":false,"url":"https://api.github.com/repos/boto/boto3","forks_url":"https://api.github.com/repos/boto/boto3/forks","keys_url":"https://api.github.com/repos/boto/boto3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/boto/boto3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/boto/boto3/teams","hooks_url":"https://api.github.com/repos/boto/boto3/hooks","issue_events_url":"https://api.github.com/repos/boto/boto3/issues/events{/number}","events_url":"https://api.github.com/repos/boto/boto3/events","assignees_url":"https://api.github.com/repos/boto/boto3/assignees{/user}","branches_url":"https://api.github.com/repos/boto/boto3/branches{/branch}","tags_url":"https://api.github.com/repos/boto/boto3/tags","blobs_url":"https://api.github.com/repos/boto/boto3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/boto/boto3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/boto/boto3/git/refs{/sha}","trees_url":"https://api.github.com/repos/boto/boto3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/boto/boto3/statuses/{sha}","languages_url":"https://api.github.com/repos/boto/boto3/languages","stargazers_url":"https://api.github.com/repos/boto/boto3/stargazers","contributors_url":"https://api.github.com/repos/boto/boto3/contributors","subscribers_url":"https://api.github.com/repos/boto/boto3/subscribers","subscription_url":"https://api.github.com/repos/boto/boto3/subscription","commits_url":"https://api.github.com/repos/boto/boto3/commits{/sha}","git_commits_url":"https://api.github.com/repos/boto/boto3/git/commits{/sha}","comments_url":"https://api.github.com/repos/boto/boto3/comments{/number}","issue_comment_url":"https://api.github.com/repos/boto/boto3/issues/comments{/number}","contents_url":"https://api.github.com/repos/boto/boto3/contents/{+path}","compare_url":"https://api.github.com/repos/boto/boto3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/boto/boto3/merges","archive_url":"https://api.github.com/repos/boto/boto3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/boto/boto3/downloads","issues_url":"https://api.github.com/repos/boto/boto3/issues{/number}","pulls_url":"https://api.github.com/repos/boto/boto3/pulls{/number}","milestones_url":"https://api.github.com/repos/boto/boto3/milestones{/number}","notifications_url":"https://api.github.com/repos/boto/boto3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/boto/boto3/labels{/name}","releases_url":"https://api.github.com/repos/boto/boto3/releases{/id}","created_at":"2014-10-03T21:38:03Z","updated_at":"2015-03-26T20:06:19Z","pushed_at":"2015-03-26T20:20:57Z","git_url":"git://github.com/boto/boto3.git","ssh_url":"git@github.com:boto/boto3.git","clone_url":"https://github.com/boto/boto3.git","svn_url":"https://github.com/boto/boto3","homepage":"http://aws.amazon.com/sdk-for-python/","size":1394,"stargazers_count":82,"watchers_count":82,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":5,"forks":18,"open_issues":5,"watchers":82,"default_branch":"develop"}},"base":{"label":"boto:develop","ref":"develop","sha":"8aa7202e4c407b6e65f34a3c42f702963ee40f47","user":{"login":"boto","id":327752,"avatar_url":"https://avatars.githubusercontent.com/u/327752?v=3","gravatar_id":"","url":"https://api.github.com/users/boto","html_url":"https://github.com/boto","followers_url":"https://api.github.com/users/boto/followers","following_url":"https://api.github.com/users/boto/following{/other_user}","gists_url":"https://api.github.com/users/boto/gists{/gist_id}","starred_url":"https://api.github.com/users/boto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boto/subscriptions","organizations_url":"https://api.github.com/users/boto/orgs","repos_url":"https://api.github.com/users/boto/repos","events_url":"https://api.github.com/users/boto/events{/privacy}","received_events_url":"https://api.github.com/users/boto/received_events","type":"Organization","site_admin":false},"repo":{"id":24774658,"name":"boto3","full_name":"boto/boto3","owner":{"login":"boto","id":327752,"avatar_url":"https://avatars.githubusercontent.com/u/327752?v=3","gravatar_id":"","url":"https://api.github.com/users/boto","html_url":"https://github.com/boto","followers_url":"https://api.github.com/users/boto/followers","following_url":"https://api.github.com/users/boto/following{/other_user}","gists_url":"https://api.github.com/users/boto/gists{/gist_id}","starred_url":"https://api.github.com/users/boto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boto/subscriptions","organizations_url":"https://api.github.com/users/boto/orgs","repos_url":"https://api.github.com/users/boto/repos","events_url":"https://api.github.com/users/boto/events{/privacy}","received_events_url":"https://api.github.com/users/boto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/boto/boto3","description":"**Developer Preview** AWS SDK for Python","fork":false,"url":"https://api.github.com/repos/boto/boto3","forks_url":"https://api.github.com/repos/boto/boto3/forks","keys_url":"https://api.github.com/repos/boto/boto3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/boto/boto3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/boto/boto3/teams","hooks_url":"https://api.github.com/repos/boto/boto3/hooks","issue_events_url":"https://api.github.com/repos/boto/boto3/issues/events{/number}","events_url":"https://api.github.com/repos/boto/boto3/events","assignees_url":"https://api.github.com/repos/boto/boto3/assignees{/user}","branches_url":"https://api.github.com/repos/boto/boto3/branches{/branch}","tags_url":"https://api.github.com/repos/boto/boto3/tags","blobs_url":"https://api.github.com/repos/boto/boto3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/boto/boto3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/boto/boto3/git/refs{/sha}","trees_url":"https://api.github.com/repos/boto/boto3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/boto/boto3/statuses/{sha}","languages_url":"https://api.github.com/repos/boto/boto3/languages","stargazers_url":"https://api.github.com/repos/boto/boto3/stargazers","contributors_url":"https://api.github.com/repos/boto/boto3/contributors","subscribers_url":"https://api.github.com/repos/boto/boto3/subscribers","subscription_url":"https://api.github.com/repos/boto/boto3/subscription","commits_url":"https://api.github.com/repos/boto/boto3/commits{/sha}","git_commits_url":"https://api.github.com/repos/boto/boto3/git/commits{/sha}","comments_url":"https://api.github.com/repos/boto/boto3/comments{/number}","issue_comment_url":"https://api.github.com/repos/boto/boto3/issues/comments{/number}","contents_url":"https://api.github.com/repos/boto/boto3/contents/{+path}","compare_url":"https://api.github.com/repos/boto/boto3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/boto/boto3/merges","archive_url":"https://api.github.com/repos/boto/boto3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/boto/boto3/downloads","issues_url":"https://api.github.com/repos/boto/boto3/issues{/number}","pulls_url":"https://api.github.com/repos/boto/boto3/pulls{/number}","milestones_url":"https://api.github.com/repos/boto/boto3/milestones{/number}","notifications_url":"https://api.github.com/repos/boto/boto3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/boto/boto3/labels{/name}","releases_url":"https://api.github.com/repos/boto/boto3/releases{/id}","created_at":"2014-10-03T21:38:03Z","updated_at":"2015-03-26T20:06:19Z","pushed_at":"2015-03-26T20:20:57Z","git_url":"git://github.com/boto/boto3.git","ssh_url":"git@github.com:boto/boto3.git","clone_url":"https://github.com/boto/boto3.git","svn_url":"https://github.com/boto/boto3","homepage":"http://aws.amazon.com/sdk-for-python/","size":1394,"stargazers_count":82,"watchers_count":82,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":5,"forks":18,"open_issues":5,"watchers":82,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/boto/boto3/pulls/75"},"html":{"href":"https://github.com/boto/boto3/pull/75"},"issue":{"href":"https://api.github.com/repos/boto/boto3/issues/75"},"comments":{"href":"https://api.github.com/repos/boto/boto3/issues/75/comments"},"review_comments":{"href":"https://api.github.com/repos/boto/boto3/pulls/75/comments"},"review_comment":{"href":"https://api.github.com/repos/boto/boto3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/boto/boto3/pulls/75/commits"},"statuses":{"href":"https://api.github.com/repos/boto/boto3/statuses/f2c61832945dda2e054f3d7e5e53f5fd8c443405"}}}}