With S3, you can protect your data using encryption. You’ll explore server-side encryption using the AES-256 algorithm where AWS manages both the encryption and the keys.
00:00 When you upload files to S3, you don’t need to leave them in plaintext for anyone to look at if they get access to the server. In this video, you’ll learn how to add server-side encryption to files.
The best part is that AWS manages the encryption and the keys, so it’s relatively straightforward to start using right away. First, let’s create a third file, and we’ll save the
third_file_name using the
create_temp_file(). And this one, just say
300 bytes, call it
'thirdfile.txt', and fill this one up with
and save it with the rest. Okay. Now you need to upload that file, and this will be pretty straightforward, like last time. Make a new
Object instance and this’ll be equal to the
s3_resource.Object(), and this will go into that first bucket as well, but this time pass in the
Okay. And like before, you now have this
third_object instance, but it hasn’t been uploaded. So you need to call
.upload_file(), pass in the
third_file_name, and like the ACL examples, you’re going to pass in some extra arguments.
Close everything off. And no errors! All right! So now that that’s been uploaded, that resource object actually saves that information as a property. So you could say
third_object and then take a look at this
.server_side_encryption property, and it’ll return to you that
Become a Member to join the conversation.