{"id":"l-aws-3-2","courseId":"aws-cloud-foundations","lang":"en","kind":"lesson","summary":"Store Lantern’s posters and backups in Amazon S3 with the right storage class, versioning and Block Public Access, and know when an EC2 workload needs EBS or EFS instead.","html":"<p>On Lantern’s old server, “storage” was one disk that filled up. On AWS you get three different kinds, each shaped for a different job: <strong>objects</strong> in Amazon S3, <strong>block disks</strong> in Amazon EBS, and <strong>shared files</strong> in Amazon EFS. Most of Lantern’s data belongs in the first.</p>\n<h2 id=\"sec-1\" tabindex=\"-1\">Amazon S3: objects in buckets</h2>\n<p>S3 stores <strong>objects</strong> (any bytes, up to 50 TB each) in <strong>buckets</strong>. An object is addressed by its <strong>key</strong>, such as <code dir=\"ltr\">posters/2026/street-food-festival.jpg</code>. The slashes look like folders, and the console draws them as folders, but S3 has no directories: the key is one string, and <code dir=\"ltr\">posters/2026/</code> is a <strong>prefix</strong>. Bucket names are unique across all of AWS; the bucket itself lives in the Region you choose.</p>\n<div class=\"code-block\" dir=\"ltr\" data-lang=\"bash\" data-index=\"0\"><div class=\"code-head\"><span class=\"code-title\">Terminal</span><span class=\"code-actions\"><button type=\"button\" class=\"code-btn\" data-action=\"copy\" aria-label=\"Copy code\"><svg class=\"icon \" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/></svg><span>Copy</span></button></span></div><pre class=\"shiki\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#953800;--shiki-dark:#FFA657\">aws</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> s3</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> mb</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> s3://lantern-posters</span><span style=\"color:#0550AE;--shiki-dark:#79C0FF\"> --region</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> eu-west-1</span></span>\n<span class=\"line\"><span style=\"color:#953800;--shiki-dark:#FFA657\">aws</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> s3</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> cp</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> ./posters/</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> s3://lantern-posters/posters/</span><span style=\"color:#0550AE;--shiki-dark:#79C0FF\"> --recursive</span></span>\n<span class=\"line\"><span style=\"color:#953800;--shiki-dark:#FFA657\">aws</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> s3</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> ls</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> s3://lantern-posters/posters/2026/</span></span></code></pre></div>\n<h3 id=\"sec-2\" tabindex=\"-1\">Safe by default, and keep it that way</h3>\n<p>New buckets come with three protections switched on: <strong>Block Public Access</strong> (all four settings on), <strong>Object Ownership set to bucket owner enforced</strong> (access control lists disabled, so only policies grant access), and <strong>default encryption</strong> with S3-managed keys. You change access with bucket policies, as you did in section two.</p>\n<p>Leave Block Public Access on for every bucket that isn’t deliberately public, and set it at the account level too, so a single mistaken bucket can’t become public:</p>\n<div class=\"code-block\" dir=\"ltr\" data-lang=\"bash\" data-index=\"1\"><div class=\"code-head\"><span class=\"code-title\">Terminal</span><span class=\"code-actions\"><button type=\"button\" class=\"code-btn\" data-action=\"copy\" aria-label=\"Copy code\"><svg class=\"icon \" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/></svg><span>Copy</span></button></span></div><pre class=\"shiki\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#953800;--shiki-dark:#FFA657\">aws</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> s3control</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> put-public-access-block</span><span style=\"color:#0550AE;--shiki-dark:#79C0FF\"> --account-id</span><span style=\"color:#0550AE;--shiki-dark:#79C0FF\"> 111122223333</span><span style=\"color:#CF222E;--shiki-dark:#FF7B72\"> \\</span></span>\n<span class=\"line\"><span style=\"color:#0550AE;--shiki-dark:#79C0FF\">  --public-access-block-configuration</span><span style=\"color:#CF222E;--shiki-dark:#FF7B72\"> \\</span></span>\n<span class=\"line\"><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\">  BlockPublicAcls=</span><span style=\"color:#0550AE;--shiki-dark:#79C0FF\">true</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\">,IgnorePublicAcls=</span><span style=\"color:#0550AE;--shiki-dark:#79C0FF\">true</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\">,BlockPublicPolicy=</span><span style=\"color:#0550AE;--shiki-dark:#79C0FF\">true</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\">,RestrictPublicBuckets=</span><span style=\"color:#0550AE;--shiki-dark:#79C0FF\">true</span></span></code></pre></div>\n<p>In section four Lantern’s website is served to the public <strong>without</strong> making any bucket public: CloudFront reads the bucket privately on visitors’ behalf.</p>\n<h3 id=\"sec-3\" tabindex=\"-1\">Storage classes: same API, different price shape</h3>\n<p>Every object has a storage class. They are all designed for the same eleven nines (99.999999999%) of durability; they differ in how you pay.</p>\n<div class=\"table-wrap\" role=\"region\" aria-label=\"Scrollable table\" tabindex=\"0\"><table><thead>\n<tr>\n<th>Class</th>\n<th>Best for</th>\n<th>The catch</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>S3 Standard (default)</td>\n<td>Frequently read data</td>\n<td>Highest storage price</td>\n</tr>\n<tr>\n<td>S3 Intelligent-Tiering</td>\n<td>Unknown or changing access</td>\n<td>Small per-object monitoring fee</td>\n</tr>\n<tr>\n<td>S3 Standard-IA</td>\n<td>Read about monthly, needs millisecond access</td>\n<td>Retrieval fee, 30-day minimum</td>\n</tr>\n<tr>\n<td>S3 One Zone-IA</td>\n<td>Re-creatable copies</td>\n<td>One AZ only</td>\n</tr>\n<tr>\n<td>S3 Glacier Instant Retrieval</td>\n<td>Read about quarterly, millisecond access</td>\n<td>Higher retrieval fee, 90-day minimum</td>\n</tr>\n<tr>\n<td>S3 Glacier Flexible Retrieval</td>\n<td>Archives, minutes to hours to restore</td>\n<td>Restore before reading</td>\n</tr>\n<tr>\n<td>S3 Glacier Deep Archive</td>\n<td>Rarely touched, hours to restore</td>\n<td>180-day minimum</td>\n</tr>\n</tbody>\n</table></div><p>The price model has three parts: <strong>per GB stored per month</strong>, <strong>per request</strong>, and, for the infrequent and archive classes, <strong>per GB retrieved</strong>. A cheaper storage class with frequent reads can cost more than Standard. Small objects are also a trap: the IA classes bill each object as at least 128 KB.</p>\n<p>For Lantern: current posters stay in Standard, posters older than a year move to Glacier Instant Retrieval (they still appear on old event pages), and monthly database exports go to Deep Archive.</p>\n<h3 id=\"sec-4\" tabindex=\"-1\">Versioning: an undo button with a price</h3>\n<p>With <strong>versioning</strong> on, overwriting or deleting an object keeps the old version. A delete adds a <em>delete marker</em> instead of destroying data, so an accidental <code dir=\"ltr\">aws s3 rm</code> is recoverable. Once enabled, versioning can only be suspended, never fully removed.</p>\n<div class=\"code-block\" dir=\"ltr\" data-lang=\"bash\" data-index=\"2\"><div class=\"code-head\"><span class=\"code-title\">Terminal</span><span class=\"code-actions\"><button type=\"button\" class=\"code-btn\" data-action=\"copy\" aria-label=\"Copy code\"><svg class=\"icon \" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/></svg><span>Copy</span></button></span></div><pre class=\"shiki\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#953800;--shiki-dark:#FFA657\">aws</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> s3api</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> put-bucket-versioning</span><span style=\"color:#0550AE;--shiki-dark:#79C0FF\"> --bucket</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> lantern-posters</span><span style=\"color:#CF222E;--shiki-dark:#FF7B72\"> \\</span></span>\n<span class=\"line\"><span style=\"color:#0550AE;--shiki-dark:#79C0FF\">  --versioning-configuration</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> Status=Enabled</span></span></code></pre></div>\n<p>Every version is billed as a full object, so pair versioning with a <strong>lifecycle rule</strong> that moves and expires data automatically:</p>\n<div class=\"code-block\" dir=\"ltr\" data-lang=\"json\" data-index=\"3\"><div class=\"code-head\"><span class=\"code-title\">lifecycle.json</span><span class=\"code-actions\"><button type=\"button\" class=\"code-btn\" data-action=\"copy\" aria-label=\"Copy code\"><svg class=\"icon \" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/></svg><span>Copy</span></button></span></div><pre class=\"shiki\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">{</span></span>\n<span class=\"line\"><span style=\"color:#116329;--shiki-dark:#7EE787\">  \"Rules\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">: [</span></span>\n<span class=\"line\"><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">    {</span></span>\n<span class=\"line\"><span style=\"color:#116329;--shiki-dark:#7EE787\">      \"ID\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">: </span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\">\"age-out-posters\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">,</span></span>\n<span class=\"line\"><span style=\"color:#116329;--shiki-dark:#7EE787\">      \"Filter\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">: { </span><span style=\"color:#116329;--shiki-dark:#7EE787\">\"Prefix\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">: </span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\">\"posters/\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\"> },</span></span>\n<span class=\"line\"><span style=\"color:#116329;--shiki-dark:#7EE787\">      \"Status\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">: </span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\">\"Enabled\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">,</span></span>\n<span class=\"line\"><span style=\"color:#116329;--shiki-dark:#7EE787\">      \"Transitions\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">: [{ </span><span style=\"color:#116329;--shiki-dark:#7EE787\">\"Days\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">: </span><span style=\"color:#0550AE;--shiki-dark:#79C0FF\">365</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">, </span><span style=\"color:#116329;--shiki-dark:#7EE787\">\"StorageClass\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">: </span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\">\"GLACIER_IR\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\"> }],</span></span>\n<span class=\"line\"><span style=\"color:#116329;--shiki-dark:#7EE787\">      \"NoncurrentVersionExpiration\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">: { </span><span style=\"color:#116329;--shiki-dark:#7EE787\">\"NoncurrentDays\"</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">: </span><span style=\"color:#0550AE;--shiki-dark:#79C0FF\">30</span><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\"> }</span></span>\n<span class=\"line\"><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">    }</span></span>\n<span class=\"line\"><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">  ]</span></span>\n<span class=\"line\"><span style=\"color:#1F2328;--shiki-dark:#E6EDF3\">}</span></span></code></pre></div>\n<div class=\"code-block\" dir=\"ltr\" data-lang=\"bash\" data-index=\"4\"><div class=\"code-head\"><span class=\"code-title\">Terminal</span><span class=\"code-actions\"><button type=\"button\" class=\"code-btn\" data-action=\"copy\" aria-label=\"Copy code\"><svg class=\"icon \" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/></svg><span>Copy</span></button></span></div><pre class=\"shiki\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#953800;--shiki-dark:#FFA657\">aws</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> s3api</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> put-bucket-lifecycle-configuration</span><span style=\"color:#0550AE;--shiki-dark:#79C0FF\"> --bucket</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> lantern-posters</span><span style=\"color:#CF222E;--shiki-dark:#FF7B72\"> \\</span></span>\n<span class=\"line\"><span style=\"color:#0550AE;--shiki-dark:#79C0FF\">  --lifecycle-configuration</span><span style=\"color:#0A3069;--shiki-dark:#A5D6FF\"> file://lifecycle.json</span></span></code></pre></div>\n<aside class=\"callout callout-mistake\" role=\"note\"><p class=\"callout-title\"><svg class=\"icon \" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\"/><path d=\"M12 9v4\"/><path d=\"M12 17h.01\"/></svg><span><span class=\"callout-kind\">Common mistake</span><span class=\"callout-sep\" aria-hidden=\"true\"> · </span>Versioning without a lifecycle rule</span></p>\n<p>Teams turn on versioning for safety, then a script rewrites thousands of objects every night. Six months later the bucket holds 180 copies of everything and the bill shows it. Whenever you enable versioning, add a <code dir=\"ltr\">NoncurrentVersionExpiration</code> rule in the same change.</p>\n</aside>\n<h2 id=\"sec-5\" tabindex=\"-1\">Disks for servers: EBS and EFS</h2>\n<p>Some software needs a real file system. That is where the other two services come in.</p>\n<figure class=\"diagram\"><svg class=\"diagram-svg\" focusable=\"false\" viewBox=\"0 0 680 250\" role=\"img\" aria-labelledby=\"l-aws-3-2-t1\"><defs><marker id=\"arrow-l-aws-3-2-1\" viewBox=\"0 0 10 10\" refX=\"9\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0 L10 5 L0 10 z\" class=\"d-arrowhead\"/></marker></defs>\n  <title id=\"l-aws-3-2-t1\">S3 is accessed by any client over HTTPS. An EBS volume attaches to a single EC2 instance inside one Availability Zone. An EFS file system is mounted by instances in two Availability Zones at once.</title>\n  <rect class=\"d-box-primary\" x=\"20\" y=\"90\" width=\"150\" height=\"60\" rx=\"10\"/>\n  <text class=\"d-label\" x=\"95\" y=\"117\" text-anchor=\"middle\">Amazon S3</text>\n  <text class=\"d-label-muted\" x=\"95\" y=\"137\" text-anchor=\"middle\">objects via API</text>\n  <text class=\"d-label-muted\" x=\"95\" y=\"70\" text-anchor=\"middle\">browsers, Lambda, CLI</text>\n  <path class=\"d-arrow\" d=\"M95 76 L95 86\" marker-end=\"url(#arrow-l-aws-3-2-1)\"/>\n  <rect class=\"d-box\" x=\"210\" y=\"30\" width=\"200\" height=\"190\" rx=\"12\"/>\n  <text class=\"d-label-muted\" x=\"310\" y=\"52\" text-anchor=\"middle\">AZ a</text>\n  <rect class=\"d-box-accent\" x=\"240\" y=\"70\" width=\"140\" height=\"44\" rx=\"8\"/>\n  <text class=\"d-label\" x=\"310\" y=\"97\" text-anchor=\"middle\">EC2 instance</text>\n  <rect class=\"d-box-success\" x=\"255\" y=\"150\" width=\"110\" height=\"40\" rx=\"8\"/>\n  <text class=\"d-label\" x=\"310\" y=\"175\" text-anchor=\"middle\">EBS volume</text>\n  <path class=\"d-arrow\" d=\"M310 148 L310 118\" marker-end=\"url(#arrow-l-aws-3-2-1)\"/>\n  <rect class=\"d-box\" x=\"450\" y=\"30\" width=\"210\" height=\"110\" rx=\"12\"/>\n  <text class=\"d-label-muted\" x=\"555\" y=\"52\" text-anchor=\"middle\">AZ b</text>\n  <rect class=\"d-box-accent\" x=\"485\" y=\"70\" width=\"140\" height=\"44\" rx=\"8\"/>\n  <text class=\"d-label\" x=\"555\" y=\"97\" text-anchor=\"middle\">EC2 instance</text>\n  <rect class=\"d-box-warn\" x=\"430\" y=\"180\" width=\"160\" height=\"44\" rx=\"8\"/>\n  <text class=\"d-label\" x=\"510\" y=\"207\" text-anchor=\"middle\">Amazon EFS</text>\n  <path class=\"d-arrow\" d=\"M480 180 L360 114\" marker-end=\"url(#arrow-l-aws-3-2-1)\"/>\n  <path class=\"d-arrow\" d=\"M530 180 L550 118\" marker-end=\"url(#arrow-l-aws-3-2-1)\"/>\n</svg><figcaption>S3 is reached over HTTPS, EBS attaches to one instance, EFS is shared</figcaption></figure>\n<p><strong>Amazon EBS</strong> (Elastic Block Store) is a network disk for <strong>one</strong> EC2 instance, in <strong>one</strong> Availability Zone. Almost every instance boots from one. <code dir=\"ltr\">gp3</code> is the general-purpose SSD type to start with. You pay for the <strong>provisioned</strong> size, not what you fill, so a 500 GB volume holding 20 GB costs the same as a full one. <strong>Snapshots</strong> back volumes up incrementally to storage that survives the loss of the AZ.</p>\n<p><strong>Amazon EFS</strong> (Elastic File System) is a managed NFS file system that <strong>many</strong> instances, across AZs, mount at the same time. It grows and shrinks with your files and bills per gigabyte actually stored, at a higher rate per gigabyte than EBS. Use it when several servers must share one directory tree.</p>\n<p>For Lantern, the answer is mostly “neither”: posters live in S3, where Lambda and CloudFront can reach them. The temporary migration server gets one small <code dir=\"ltr\">gp3</code> volume, and no EFS at all.</p>\n<aside class=\"callout callout-tip\" role=\"note\"><p class=\"callout-title\"><svg class=\"icon \" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\"/><path d=\"M9 18h6\"/><path d=\"M10 22h4\"/></svg><span><span class=\"callout-kind\">Tip</span><span class=\"callout-sep\" aria-hidden=\"true\"> · </span>Ask “who reads this, and how?”</span></p>\n<p>If code or browsers read it over HTTP, use S3. If one server needs a disk, use EBS. If several servers need the same folder, use EFS. That one question settles most storage choices.</p>\n</aside>\n<p>Files are settled. Next: the data that changes every second, in a database.</p>\n","toc":[{"id":"sec-1","text":"Amazon S3: objects in buckets","level":2},{"id":"sec-2","text":"Safe by default, and keep it that way","level":3},{"id":"sec-3","text":"Storage classes: same API, different price shape","level":3},{"id":"sec-4","text":"Versioning: an undo button with a price","level":3},{"id":"sec-5","text":"Disks for servers: EBS and EFS","level":2}],"takeaways":["Amazon S3 stores objects under keys in buckets, and new buckets block public access, disable ACLs and encrypt objects by default.","Storage classes trade storage price against retrieval cost, retrieval speed and minimum storage duration; S3 Standard is the default.","Versioning keeps every version of every object, which protects against overwrites and deletes but bills for each stored version until a lifecycle rule expires it.","Amazon EBS is a block disk for one EC2 instance in one Availability Zone, billed per provisioned gigabyte.","Amazon EFS is a shared file system that many instances across AZs can mount at once, billed per gigabyte actually stored."],"further":[{"title":"Understanding and managing Amazon S3 storage classes","url":"https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html"},{"title":"Blocking public access to your Amazon S3 storage","url":"https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html"},{"title":"Retaining multiple versions of objects with S3 Versioning","url":"https://docs.aws.amazon.com/AmazonS3/latest/userguide/Versioning.html"},{"title":"What is Amazon Elastic File System?","url":"https://docs.aws.amazon.com/efs/latest/ug/whatisefs.html"}],"quiz":[{"q":"<p>Lantern keeps monthly database exports for seven years and expects to restore one perhaps once a year, with a few hours’ wait acceptable. Which storage class fits?</p>","options":[{"text":"S3 Glacier Deep Archive","why":"Correct. It has the lowest storage price, and its retrieval time of hours is fine for a once-a-year restore."},{"text":"S3 Standard","why":"It works, but you pay the highest storage price for years on data that is almost never read."},{"text":"S3 One Zone-IA","why":"It keeps data in a single Availability Zone, so losing that AZ could lose the only copy of seven years of backups."},{"text":"S3 Express One Zone","why":"It is built for single-digit-millisecond access by latency-sensitive apps, which is the opposite of an archive."}],"answer":0},{"q":"<p>Versioning is on for the posters bucket. An organiser re-uploads the same poster 40 times while tweaking it. What happens to storage costs?</p>","options":[{"text":"Nothing changes; S3 stores only the latest version.","why":"With versioning on, every overwrite keeps the previous object as a noncurrent version."},{"text":"Lantern pays for all 40 versions until a lifecycle rule or a person deletes the noncurrent ones.","why":"Correct. Each version is a full stored object. A NoncurrentVersionExpiration rule keeps this under control."},{"text":"S3 deduplicates identical uploads, so only changed bytes are billed.","why":"S3 does not deduplicate. Every version is billed at its full size."}],"answer":1},{"q":"<p>Three EC2 instances in different Availability Zones must read and write the same set of uploaded files through a normal file system path. What do you use?</p>","options":[{"text":"One EBS volume attached to all three instances.","why":"A standard EBS volume attaches to one instance, and it lives in a single AZ, so instances in other AZs cannot use it."},{"text":"An instance store volume on each instance.","why":"Instance store is local to one instance and its data disappears when the instance stops, so nothing is shared."},{"text":"An Amazon EFS file system mounted on all three.","why":"Correct. EFS is a regional, shared NFS file system that instances in several AZs can mount at the same time."}],"answer":2}],"exercise":{"kind":"fill","language":"bash","template":"# 1. Upload the whole local posters folder, including subfolders\naws s3 {{0}} ./posters/ s3://lantern-posters/posters/ --{{1}}\n\n# 2. Keep old versions when posters are overwritten or deleted\naws s3api put-bucket-versioning --bucket lantern-posters \\\n  --versioning-configuration Status={{2}}\n\n# 3. Store this month's export in the cheapest archive class\naws s3 cp ./exports/2026-09.sql.gz s3://lantern-backups/exports/ \\\n  --storage-class {{3}}","blanks":[{"answers":["cp"]},{"answers":["recursive"]},{"answers":["Enabled"]},{"answers":["DEEP_ARCHIVE"]}],"title":"Upload, protect and archive","prompt":"<p>Finish three commands for Lantern’s storage. Step 1 copies the local <code dir=\"ltr\">posters/</code> folder and all its subfolders into the bucket with the copy command. Step 2 turns on versioning. Step 3 uploads a database export that must be kept for seven years at the lowest storage price, where waiting hours for a restore is acceptable. Use the storage class’s API name, in capitals.</p>\n","hints":["The high-level <code dir=\"ltr\">aws s3</code> copy command is two letters, and it needs a flag to descend into folders.","Versioning’s status values are <code dir=\"ltr\">Enabled</code> and <code dir=\"ltr\">Suspended</code>.","The archive class with the lowest storage price and a 180-day minimum is written with an underscore."],"explanation":"<p><code dir=\"ltr\">aws s3 cp</code> with <code dir=\"ltr\">--recursive</code> copies every file under the folder, keeping the relative paths as key prefixes. (<code dir=\"ltr\">aws s3 sync</code> would also work and only uploads changed files, but it takes no <code dir=\"ltr\">--recursive</code> flag.) <code dir=\"ltr\">Status=Enabled</code> turns versioning on; after that you can only suspend it. <code dir=\"ltr\">--storage-class DEEP_ARCHIVE</code> puts the export straight into S3 Glacier Deep Archive, which has the lowest storage price, a 180-day minimum storage duration and restores measured in hours, a good fit for files you hope never to need.</p>\n","checkLabels":{}},"words":794,"readMinutes":4}