{"id":2759,"date":"2018-06-13T17:42:16","date_gmt":"2018-06-13T17:42:16","guid":{"rendered":"http:\/\/blog.paranoidprofessor.com\/?p=2759"},"modified":"2018-06-25T20:44:03","modified_gmt":"2018-06-25T20:44:03","slug":"aws-s3-buckets","status":"publish","type":"post","link":"https:\/\/blog.paranoidprofessor.com\/index.php\/2018\/06\/13\/aws-s3-buckets\/","title":{"rendered":"AWS &#8211; S3 buckets"},"content":{"rendered":"<p>Amazon AWS is a very rich infrastructure.\u00a0 It is not uncommon for AWS to field several different yet somewhat similar types of services.\u00a0 The area of data storage is one of those areas where there is a rich set to pick from.\u00a0 Not all services are suitable for all tasks but when data needs to be stored there are quite a number to choose from.<\/p>\n<ul>\n<li>S3<\/li>\n<li>Elastic File System &#8211; EFS<\/li>\n<li>Elastic Block Store &#8211; EBS<\/li>\n<li>Amazon Glacier<\/li>\n<\/ul>\n<p>In this post I will be examining S3 to demonstrate setting it up as well as discussing some of it&#8217;s uses.<\/p>\n<p>First of all, S3 is not a file system but it can also be mounted as such.\u00a0 Amazon created S3 as a place where you can store whole objects and these objects (pictures, pdf&#8217;s, videos) are what most users would consider to be an actual file.\u00a0 The difference in how S3 treats these objects becomes obvious when there is a change in the object.<\/p>\n<p>A normal file system might be able to change one or two blocks of the file that encompass the change but for S3 the entire object is rewritten to the object store.\u00a0 This isn&#8217;t anything too dramatic unless you have a lot of objects constantly under change or have very large objects such as database backups or large videos.<\/p>\n<p>Perhaps to try and keep the S3 distinguishable from their other options, Amazon has given the name of their S3 &#8220;devices&#8221; the name of bucket.\u00a0 Which to most users won&#8217;t be confused with hard drive or disk drive.<\/p>\n<h2>Setting up a bucket<\/h2>\n<p>The process of setting up a S3 storage bucket is really just a matter of a few clicks.\u00a0 Before you do so there are a few small details that must be considered before starting.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2784\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-00-s3-bucket-list.png\" alt=\"\" width=\"1008\" height=\"436\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-00-s3-bucket-list.png 1008w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-00-s3-bucket-list-300x130.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-00-s3-bucket-list-768x332.png 768w\" sizes=\"(max-width: 1008px) 100vw, 1008px\" \/><\/p>\n<p>The most important detail is what is the name of the bucket.\u00a0 This is more important than the normal &#8220;computer&#8221; reason of good naming makes using it easier.\u00a0 The reason is that despite a bucket being associated with a specific region the name of the bucket must be unique for all buckets in S3 worldwide.<\/p>\n<p>You also need to know which region your data should be stored.\u00a0 There doesn&#8217;t seem to be any limitations on accessing this data regardless of the region.\u00a0 A few of the reasons that the region might be important depends on the company or personal situation.<\/p>\n<ul>\n<li>close to clients who will access data<\/li>\n<li>stored in a specific region for legal reasons (ie. EU data privacy)<\/li>\n<li>stored in a specific region for safety reasons (far away for catastrophe concerns\u00a0 )<\/li>\n<\/ul>\n<p>Does the data need to be encrypted and who should be able to access this data are the final important questions.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-2785\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket1-300x282.png\" alt=\"\" width=\"300\" height=\"282\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket1-300x282.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket1.png 705w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\u00a0<img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-2786\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket2-261x300.png\" alt=\"\" width=\"244\" height=\"280\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket2-261x300.png 261w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket2.png 704w\" sizes=\"(max-width: 244px) 100vw, 244px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-2787\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket3-261x300.png\" alt=\"\" width=\"261\" height=\"300\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket3-261x300.png 261w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket3.png 704w\" sizes=\"(max-width: 261px) 100vw, 261px\" \/>\u00a0 \u00a0 \u00a0\u00a0<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-2788\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket4-262x300.png\" alt=\"\" width=\"262\" height=\"300\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket4-262x300.png 262w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket4.png 706w\" sizes=\"(max-width: 262px) 100vw, 262px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2789\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket5-created.png\" alt=\"\" width=\"707\" height=\"807\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket5-created.png 707w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-01-s3-create-bucket5-created-263x300.png 263w\" sizes=\"(max-width: 707px) 100vw, 707px\" \/><\/p>\n<p>Just like many of the AWS services it is possible to set tags on the various objects you create.\u00a0 This might be a tag on the bucket or a tag on an uploaded data file.\u00a0 Tags are not so useful for the sake of description but are helpful to try and discover where exactly the costs are being used when examining your bill.<\/p>\n<h2>Uploading an object<\/h2>\n<p>Actually uploading a file is as simple as saving a file on your personal computer but does contain a few elements from the bucket creation.\u00a0 The important elements are storage class, encryption, tagging, and permissions.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2790\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload1-to-folder.png\" alt=\"\" width=\"945\" height=\"345\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload1-to-folder.png 945w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload1-to-folder-300x110.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload1-to-folder-768x280.png 768w\" sizes=\"(max-width: 945px) 100vw, 945px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-2791\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload2-to-folder-300x263.png\" alt=\"\" width=\"300\" height=\"263\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload2-to-folder-300x263.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload2-to-folder.png 705w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\u00a0 \u00a0 \u00a0<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-2792\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload3-to-folder-300x264.png\" alt=\"\" width=\"300\" height=\"264\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload3-to-folder-300x264.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload3-to-folder.png 704w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-2793\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload4-to-folder-300x263.png\" alt=\"\" width=\"300\" height=\"263\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload4-to-folder-300x263.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload4-to-folder.png 704w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\u00a0 \u00a0\u00a0<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-2794\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload5-to-folder-300x262.png\" alt=\"\" width=\"300\" height=\"262\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload5-to-folder-300x262.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-03-s3-upload5-to-folder.png 702w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>The good news is that the file is uploaded but if you took a close look at the permissions of the uploaded file, it is not actually possible for anyone else to read this but my account.<\/p>\n<p>Simply go back to the file and change the permissions so this file is public.<\/p>\n<div id=\"attachment_2795\" style=\"width: 840px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-2795\" decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2795\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-06-s3-permissions-before.png\" alt=\"\" width=\"830\" height=\"179\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-06-s3-permissions-before.png 830w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-06-s3-permissions-before-300x65.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-06-s3-permissions-before-768x166.png 768w\" sizes=\"(max-width: 830px) 100vw, 830px\" \/><p id=\"caption-attachment-2795\" class=\"wp-caption-text\">Permissions before<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_2796\" style=\"width: 841px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-2796\" decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2796\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-06-s3-permissions-after.png\" alt=\"\" width=\"831\" height=\"173\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-06-s3-permissions-after.png 831w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-06-s3-permissions-after-300x62.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2018\/01\/aws-06-s3-permissions-after-768x160.png 768w\" sizes=\"(max-width: 831px) 100vw, 831px\" \/><p id=\"caption-attachment-2796\" class=\"wp-caption-text\">Permissions after<\/p><\/div>\n<p>Once this small permission change is completed then it is possible to access this file from the S3 bucket as an average user with no AWS account.<\/p>\n<p>It is interesting to note that there are two different layers of permissions and if both of them do not allow a normal person to access the file you will receive a 403 error when trying to access this object.<\/p>\n<h2>Other features of S3<\/h2>\n<h3>Object versioning<\/h3>\n<p>This is by no means the end of the story for S3 buckets.\u00a0 It is also possible to enable file versioning.\u00a0 This is not totally unique in the history of computer science to have such a &#8220;file-system&#8221; with versioning.\u00a0 This was also implemented RSX-11 and OpenVMS which simply stored (VMS) a simple ordinal number with the file that was increased with each successive new file of that name.<\/p>\n<p>I am not planning on discussing the versioning that Amazon provides but there are a number of different <a href=\"https:\/\/www.youtube.com\/watch?v=_e1Jez0GPmA\" target=\"_blank\" rel=\"noopener\">videos <\/a>available on YouTube.\u00a0 It is interesting that Amazon provides such a long unique identifier.\u00a0 It is possible that this identifier is unique across all versioned files that are saved in S3.<\/p>\n<h3>Notifications \/ events<\/h3>\n<p>It is possible to publish notify events when something occurs in your bucket.\u00a0 It is also possible to have a lambda function use this event as its input.\u00a0 Depending on how you are using S3 it is also possible to use the life cycle rules to transition the data to a different storage class after a certain period of time.\u00a0 Likewise it is also possible to expire objects or delete expired objects after a given period of time.<\/p>\n<p>Finally it is possible to replicate your data to other regions as well as gather analytics and metrics for your bucket.\u00a0 This information could be used in reporting.<\/p>\n<h2>Parting shot<\/h2>\n<p>S3 is really pretty amazing and despite the fact it doesn&#8217;t have elastic in the name is is a pretty elastic service.\u00a0 It does provide a nice place to save rather static data but it does have one thing going for it that may easily overlooked &#8211; it is as big as you need it to be.<\/p>\n<p>You are allowed to have objects between one byte and 5 terabytes in size.\u00a0 This is pretty huge but it will automatically scale in the background.\u00a0 It is not a disk with a fixed size, it is a work-space that you can store an unlimited number of objects that can be really quite large.<\/p>\n<p>Although I haven&#8217;t done it, it makes you wonder if this would be an interesting replacement for other services that allow you to have a &#8220;virtual disk&#8221; on the internet.\u00a0 The pricing is fairly cheap.<\/p>\n<p><a href=\"https:\/\/aws.amazon.com\/s3\/pricing\/\" target=\"_blank\" rel=\"noopener\">AWS pricing<\/a><\/p>\n<p>I currently use another service for sharing videos of family events but after looking at the aws pricing it might be possible to reduce my costs.<\/p>\n<p>Your mileage may vary but if the files are not heavily accessed nor super large this might be an alternative.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Amazon AWS is a very rich infrastructure.\u00a0 It is not uncommon for AWS to field several different yet somewhat similar types of services.\u00a0 The area of data storage is one of those areas where there is a rich set to &hellip; <a href=\"https:\/\/blog.paranoidprofessor.com\/index.php\/2018\/06\/13\/aws-s3-buckets\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[95,90,85],"_links":{"self":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2759"}],"collection":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/comments?post=2759"}],"version-history":[{"count":8,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2759\/revisions"}],"predecessor-version":[{"id":2890,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2759\/revisions\/2890"}],"wp:attachment":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/media?parent=2759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/categories?post=2759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/tags?post=2759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}