<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ravindu Nirmal Fernando</title>
    <description>The latest articles on Forem by Ravindu Nirmal Fernando (@ravindunf).</description>
    <link>https://forem.com/ravindunf</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F828413%2Ffae54b33-fdf1-4137-a651-aa723ab543dc.jpg</url>
      <title>Forem: Ravindu Nirmal Fernando</title>
      <link>https://forem.com/ravindunf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ravindunf"/>
    <language>en</language>
    <item>
      <title>Understanding inbuilt AWS S3 security controls and methods — Part 4</title>
      <dc:creator>Ravindu Nirmal Fernando</dc:creator>
      <pubDate>Fri, 03 Feb 2023 13:45:42 +0000</pubDate>
      <link>https://forem.com/aws-builders/understanding-inbuilt-aws-s3-security-controls-and-methods-part-4-5g98</link>
      <guid>https://forem.com/aws-builders/understanding-inbuilt-aws-s3-security-controls-and-methods-part-4-5g98</guid>
      <description>&lt;p&gt;&lt;em&gt;View the version published on &lt;a href="https://medium.com/@ravindunfernando/understanding-inbuilt-aws-s3-security-controls-and-methods-part-4-53650d4e1705" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This article is the 4th and final part of a series of articles on Inbuilt AWS S3 security controls and methods. In this article, we focus on the encryption mechanisms available for AWS S3 resources.&lt;/p&gt;

&lt;p&gt;AWS S3 provides several encryption mechanisms for their customers. You have to select between each of those mechanisms based on the use case and the criticality of the data you store in S3. Hence it's really important to understand what is happening behind the scenes and apply the correct encryption mechanism to secure your data. These can be mainly categorized as Server Side Encryption and Client Side Encryption.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;We will first go through each of the Server Side Encryption mechanisms in detail.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1 — AWS Server Side Encryption with S3 Managed Keys (SSE-S3)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As announced on Jan 05th 2023, AWS will encrypt all new objects within all the buckets with SSE-S3 encryption unless another encryption mechanism was defined. You can read the announcement here — &lt;a href="https://aws.amazon.com/blogs/aws/amazon-s3-encrypts-new-objects-by-default/" rel="noopener noreferrer"&gt;https://aws.amazon.com/blogs/aws/amazon-s3-encrypts-new-objects-by-default/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the new default and easiest-to-implement encryption method within AWS S3. All you have to do is enable this and AWS S3 will handle data encryption and decryption.&lt;/p&gt;

&lt;p&gt;Underneath the following process occurs during the encryption and decryption process.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Encryption&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;1 — The client uploads data.&lt;/p&gt;

&lt;p&gt;2 — On the S3 side a plain text S3 data key is generated and then data is encrypted with that key. The encrypted data object is then stored. This encryption is symmetric encryption.&lt;/p&gt;

&lt;p&gt;3 — Then the plain text S3 data key is encrypted with S3 Master Key creating an encrypted S3 data key. Then that encrypted S3 data key is stored along with the encrypted object data and the plain text S3 data key is removed from memory.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Decryption&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;1 — The client requests data.&lt;/p&gt;

&lt;p&gt;2 — On the S3 side, the encrypted data key associated with the object is taken and decrypted using the S3 Master Key to obtain the plain text S3 data key.&lt;/p&gt;

&lt;p&gt;3 — The S3 plain text data key is then used to decrypt the encrypted object data and this object data is returned to the client.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2 — AWS Server Side Encryption with KMS Managed Keys (SSE-KMS)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This method allows S3 to use AWS KMS service to generate data encryption keys. This allows greater flexibility as you have complete control to disable, rotate apply access control to the client-managed master key used to generate encryption keys.&lt;/p&gt;

&lt;p&gt;Underneath the following process occurs during the encryption and decryption process.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Encryption&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;1 — The client uploads the data&lt;/p&gt;

&lt;p&gt;2 — S3 service then requests data keys from KMS — Customer Master Key (CMK).&lt;/p&gt;

&lt;p&gt;3 — On the KMS side the CMK generates the plaintext data key and the encrypted data key.&lt;/p&gt;

&lt;p&gt;4 — Then both of those generated keys are passed to S3.&lt;/p&gt;

&lt;p&gt;5 — Within S3. the data object is encrypted with the plain text data key and both the encrypted data object and the encrypted data key are stored on S3 while removing the plain text data key from memory.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Decryption&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;1 — Client requests data.&lt;/p&gt;

&lt;p&gt;2 — S3 service will send the encrypted data key of the object to KMS.&lt;/p&gt;

&lt;p&gt;3 — KMS will then decrypt the encrypted data key using the CMK and obtain the plain text data key.&lt;/p&gt;

&lt;p&gt;4 — Plain text data will be returned back to S3.&lt;/p&gt;

&lt;p&gt;5 — On the S3 side the plain text data key will be used to decrypt the encrypted data object.&lt;/p&gt;

&lt;p&gt;6 — The decrypted data object will be sent back to the client.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 — AWS Server Side Encryption with Customer provided Keys (SSE-C)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This method gives you the ability to provide your own master key. Your master key would be sent with your data to S3 and S3 will use that key to perform encryption for you.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Encryption&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;1 — The client will send the object data along with the customer key to S3. This will only work via an HTTPS connection.&lt;/p&gt;

&lt;p&gt;2 — On the S3 side, the data object is encrypted using the key sent by the customer. Also, a salted HMAC value of the key sent is created for future validation. Then both of the encrypted data object and salted HMAC value will be stored within S3. The customer key sent will be removed from the memory.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Decryption&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;1 — The client will request the data along with the customer key from S3. This will only work via an HTTPS connection.&lt;/p&gt;

&lt;p&gt;2 — On the S3 side, the salted HMAC value of the customer key will be used to validate the customer key sent with the request. Once validated that customer key will be used to decrypt the encrypted object data.&lt;/p&gt;

&lt;p&gt;3 — The object data will be returned to the customer.&lt;/p&gt;

&lt;h2&gt;
  
  
  We will now go through each of the Client Side Encryption mechanisms in detail.
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1 — AWS Client Side Encryption with KMS managed keys (CSE-KMS)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This method uses AWS KMS to generate data encryption keys. The AWS KMS is called by the client and encryption happens on the client side. Then the encrypted object will be sent to S3.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Encryption&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;1 — The client will communicate with AWS KMS via an AWS SDK and request data keys. They need to pass the CMK-ID of the CMK stored within KMS with the request.&lt;/p&gt;

&lt;p&gt;2 — On KMS, the CMK associated with the requested CMK-ID will be used to generate a plain text data key and cipher blob associated with the plain text data key.&lt;/p&gt;

&lt;p&gt;3 — Both the plain text data key and cipher blob key will be sent to the client.&lt;/p&gt;

&lt;p&gt;4 — On the client side the data object will be encrypted using the plain text data key received in the above step.&lt;/p&gt;

&lt;p&gt;5 — Then the encrypted data and the cipher blob key are sent to S3.&lt;/p&gt;

&lt;p&gt;6 — On S3, the encrypted data object will be stored. The cipher blob data key will be stored as metadata of the encrypted data object.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Decryption&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;1 — The client requests data&lt;/p&gt;

&lt;p&gt;2 — S3 will then send the encrypted data and cipher blob key to the client.&lt;/p&gt;

&lt;p&gt;3 — The client will then send the cipher blob key to AWS KMS using AWS SDK.&lt;/p&gt;

&lt;p&gt;4 — The cipher blob key combined with the CMK, the associated plain text data key will be generated.&lt;/p&gt;

&lt;p&gt;5 — The plaintext data key will then be sent to the client.&lt;/p&gt;

&lt;p&gt;6 — On the client side, the plain text data key will be used to decrypt the encrypted object data received from S3.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2— AWS Client Side Encryption with Customer provided keys (CSE-C)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This method allows you to use your own key to encrypt data.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Encryption&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;1 — The data object will be encrypted using client generated plain text data key.&lt;/p&gt;

&lt;p&gt;2 —Customer-managed CMK will be used to encrypt the client-generated plain text data key.&lt;/p&gt;

&lt;p&gt;3 — The encrypted data from step 1 and the encrypted data key from step 2 will be sent to S3.&lt;/p&gt;

&lt;p&gt;4 — Then the encrypted data object will be stored in S3 and the encrypted data key will be stored as metadata of the encrypted data object.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Decryption&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;1 — The client requests the data.&lt;/p&gt;

&lt;p&gt;2 — S3 will send both the encrypted data object and the encrypted key back to the client.&lt;/p&gt;

&lt;p&gt;3 — The client will then use the customer-managed CMK to generate the plain text data key by decrypting the encrypted data key.&lt;/p&gt;

&lt;p&gt;4 — Then the plain text data key will be used to decrypt the encrypted data object.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This article series will come to an end with this article. Though our main focus was to discuss about inbuilt security controls and methods within S3, there are many other services within AWS which can be used to improve and manage the overall security of your S3 resources. These services include AWS Security Hub, AWS GuardDuty, AWS Macie, AWS Trusted Advisor etc… You can read more about the S3 security best practices in detail by visiting — &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/security-best-practices.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/AmazonS3/latest/userguide/security-best-practices.html&lt;/a&gt;&lt;br&gt;
AWS continuously takes measures to improve the security posture of AWS S3. But the customer also has a major responsibility in ensuring the security of their S3 resources are configured and managed with proper security controls and methods. I hope this article series helped you to understand the importance of that.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are many other methods and controls that were not covered here and can be used to improve the security posture of AWS S3. Plus these concepts and controls are bound to be continuously updated for the better. Hence it's always better to refer to several resources and specifically official AWS documentation to have a more in-depth idea of AWS S3 security.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1 — &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/security.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/AmazonS3/latest/userguide/security.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>web3</category>
      <category>ethereum</category>
      <category>blockchain</category>
      <category>crypto</category>
    </item>
    <item>
      <title>Understanding inbuilt AWS S3 security controls and methods - Part 3</title>
      <dc:creator>Ravindu Nirmal Fernando</dc:creator>
      <pubDate>Sun, 06 Nov 2022 18:01:15 +0000</pubDate>
      <link>https://forem.com/aws-builders/understanding-inbuilt-aws-s3-security-controls-and-methods-part-3-13nc</link>
      <guid>https://forem.com/aws-builders/understanding-inbuilt-aws-s3-security-controls-and-methods-part-3-13nc</guid>
      <description>&lt;p&gt;&lt;em&gt;This article is outdated. Updated version published on &lt;a href="https://ravindunfernando.medium.com/understanding-inbuilt-aws-s3-security-controls-and-methods-part-3-124f3b9ce37e"&gt;Medium&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;In part 2 of this article series, we mainly discussed the access control policies that can be used to secure access to S3 buckets. In this article, we will focus on the access control methods which include both features and settings which S3 offers you to secure data in S3. These controls are crucial when you need to share your buckets among different applications and users or require public access to those.&lt;/p&gt;

&lt;p&gt;We are going to cover up following topics in this article,&lt;/p&gt;

&lt;p&gt;1 - S3 Access Points&lt;/p&gt;

&lt;p&gt;2 - Public Access management setting in S3&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 - S3 Access Points&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;S3 is heavily used for many use cases to store shared data sets. These data sets are being accessed by individuals, groups, and applications hence the S3 buckets which store these data sets should have shared access. The management of access to these shared buckets requires maintaining a bucket policy, IAM policy, or ACLs. These policies may include access controls to hundreds to thousands of different users, groups, and applications depending on the use case. But as the users and application sets grow, managing these individual policies will be difficult and time-consuming mainly due to their complexity. This will also make it difficult to audit the changes to the policies.&lt;/p&gt;

&lt;p&gt;AWS released the S3 Access Points feature within AWS S3 to mitigate the complexities discussed above. The service allows users to manage and control access to shared S3 buckets. The S3 access points can be attached to a single bucket and configured with separate access policies for that particular access point. This allows you the ability to create different access points with different permissions for teams and applications to your shared S3 bucket. &lt;/p&gt;

&lt;p&gt;You have to note the following points when using S3 Access Points,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You can attach an access point only to a single bucket whereas a bucket can have multiple access points attached to itself.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access points allow only object operations like S3 GetObject and S3 PutObject etc… and not bucket-specific operations like S3 DeleteBucket.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access points can be configured to accept traffic from specific VPCs and also include the Block Public Access setting which is enabled by default.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The access point policies can be used to only allow access to objects with a defined prefix or to objects with specific tags. These policies are defined in JSON. However, these policies are valid if controls allowed within access point policies are also allowed in bucket policies. Hence if you are planning to use access point policies to manage access control for your shared bucket, it's better to use bucket policy to delegate access control of the bucket to the access point as shown below.&lt;br&gt;
(Refer - &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points-policies.html"&gt;https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points-policies.html&lt;/a&gt;)&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Statement"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Principal"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"AWS"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Resource"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bucket ARN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bucket ARN/*"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Condition"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"StringEquals"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"s3:DataAccessPointAccount"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bucket owner's account ID"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When accessing the resources using access points, for S3 object operations, you can use the access point ARN in place of a bucket name. For requests requiring a bucket name in the standard S3 bucket name format, you can use an access point alias instead. Both of these details are available when you create an access point.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sPM6F9XF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eyblh744fftb7li05j6t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sPM6F9XF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eyblh744fftb7li05j6t.png" alt="Sample S3 Access Point Configuration" width="800" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read more about S3 Access Points by visiting → &lt;a href="https://aws.amazon.com/s3/features/access-points/"&gt;https://aws.amazon.com/s3/features/access-points/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2 - Public Access management setting in S3&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Over the years we have seen many incidents where sensitive information residing within S3 buckets has been exposed. This was mainly due to unprotected settings on the S3 bucket level which allowed general public access to the data within the S3 bucket. The public access management feature is available within AWS S3 to mitigate these types of configuration issues. This setting can be accessed from the permissions tab within your buckets setting and it's enabled by default when you are creating a bucket. You will have to actively change this setting to allow public access to your bucket.&lt;/p&gt;

&lt;p&gt;As shown below, you can completely turn off this setting if you require public access to your bucket, or you can select a combination of options that can be used to filter public access to your S3 buckets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oMnQmC0n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kmy6fir3ggar0plj1q8t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oMnQmC0n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kmy6fir3ggar0plj1q8t.png" alt="Block public access setting in S3" width="715" height="702"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;One thing to note here is that if you are to provide public access or cross-account access to the bucket using bucket policy or ACL, then access will still not be granted if the Block public access settings are enabled.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let’s deep dive into the Encryption mechanisms provided by AWS S3 in the upcoming article on this article series.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1 — &lt;a href="https://aws.amazon.com/s3/features/access-points/"&gt;https://aws.amazon.com/s3/features/access-points/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2 — &lt;a href="https://cloudacademy.com/course/increasing-your-security-posture-when-using-amazon-s3-1235"&gt;https://cloudacademy.com/course/increasing-your-security-posture-when-using-amazon-s3-1235&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>s3</category>
      <category>beginners</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Understanding inbuilt AWS S3 security controls and methods — Part 2</title>
      <dc:creator>Ravindu Nirmal Fernando</dc:creator>
      <pubDate>Sat, 29 Oct 2022 13:23:15 +0000</pubDate>
      <link>https://forem.com/aws-builders/understanding-inbuilt-aws-s3-security-controls-and-methods-part-2-2j7c</link>
      <guid>https://forem.com/aws-builders/understanding-inbuilt-aws-s3-security-controls-and-methods-part-2-2j7c</guid>
      <description>&lt;p&gt;&lt;strong&gt;Originally published on &lt;a href="https://ravindunfernando.medium.com/understanding-inbuilt-aws-s3-security-controls-and-methods-part-2-291d03ffc666" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This article is the second part of a series of articles on understanding inbuilt AWS S3 security controls and methods. You can access part 1 of the series by visiting &lt;a href="https://dev.to/aws-builders/understanding-inbuilt-aws-s3-security-controls-and-methods-part-1-28ng"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In this article, we will shift our focus toward the access control policies that can be defined to control access to your AWS S3 buckets. Those can be mainly divided into two main components as follows,&lt;/p&gt;

&lt;p&gt;1 — Identity-based policies&lt;/p&gt;

&lt;p&gt;2 — Resource-based policies&lt;/p&gt;

&lt;p&gt;Let’s go through each one of them and understand how can we leverage those to control access to our S3 buckets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 — Identity-based policies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Identity-based policies are the ones that can be directly attached to a user, a group that the user belongs or a role via the IAM service in AWS. These can be either inline or managed. Given below is a sample example of an IAM policy that allows the assigned identity to Put an Object, Get an Object, List an Object, Delete an Object and Get Bucket location access to the awsexamplebucket and its internal objects. The second statement also allows the identity the ability to list all the bucket's permission.&lt;/p&gt;

&lt;p&gt;One thing to note here that is identity-based policies cannot grant anonymous access to the bucket as it's always attached to a user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Statement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Sid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AssignUserActions"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"s3:PutObject"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"s3:GetObject"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"s3:ListBucket"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"s3:DeleteObject"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"s3:GetBucketLocation"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Resource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:s3:::awsexamplebucket1/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:s3:::awsexamplebucket1"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Sid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ExampleStatement2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"s3:ListAllMyBuckets"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Resource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Likewise, there are a lot of actions, resource types, and condition keys to use within IAM policies, which offers you full flexibility in defining the permissions to your S3 buckets with identity policies.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To view all available actions, resource types, and condition keys on S3, refer &lt;a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazons3.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazons3.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2 — Resource-based policies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As the name implies these policies provide access controls from the resource’s side, which are associated with either S3 objects or buckets. Due to this its required to also define what principal or in simple terms who will have the allowed/ denied access to that specific resource-based policy. From an S3 perspective, resource-based policies can be divided into two main types,&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;2.1 — Bucket Policies&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Bucket policies can be used to grant IAM users and other AWS accounts permissions to your bucket and objects in it. It's defined at the individual bucket level.&lt;/p&gt;

&lt;p&gt;Bucket policies can be added to a bucket when you click the bucket and within the Permissions tab in the AWS management console. You can also do the same programmatically as everything else if you were wondering. Bucket policies are defined in JSON. Given below is a sample bucket policy, which allows anonymous access (As the Principal is set to *) to Get objects from awsexamplebucket1. Going beyond this you can even set conditions into your bucket policies. You can refer to the link I attached above to view the available options.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Statement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Sid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"GrantAnonymousReadPermissions"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Principal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"s3:GetObject"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Resource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:s3:::awsexamplebucket1/"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;2.2 — ACLs&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;ACLs, allow you to control access to buckets and additionally to specific objects within bucket groupings and AWS accounts. ACL is a list containing grants identifying grantees and permissions associated with them. It is defined as Amazon S3–specific XML schema. Here is a sample view of the ACL settings by default to the bucket. You can access this by clicking on the S3 bucket and going to the permissions tab within the AWS management console.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftl68bd2v6n4i2trwrmwd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftl68bd2v6n4i2trwrmwd.png" alt="ACL settings in S3" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By editing the above configurations, you can also add access to another AWS account as a grantee and set up a bucket and object-specific access. The object ACL only has two permissions as List, and Write from the object ACL, unlike Write, Read permission for the Bucket ACL. Read object allows the grantee to read the object data and its metadata. Read object permissions allows the grantee to read the object ACL. Write object permissions allow the grantee to write the ACL for the object.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As AWS now recommends, for most of the general use cases it's better to go off just with ACLs disabled option as we have discussed in Part 1. But it again may depend on your use case.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In a situation where all three of the controls are used to control access to an S3 bucket, S3 will view all these policies together and any permission conflict between policies will be handled in accordance with the principle of least privilege.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Few points to keep in mind related to occasions when permission conflicts are derived,&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;**- AWS S3 follows the principle of least privilege and by default, it defines that access is denied to an object even though an explicit denial is not mentioned within any policy.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Allow should exist within a policy that principal is associated or defined within a bucket policy or ALC. Access will be granted only if Allow is defined within a policy and Deny if not defined.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If a single Deny is defined as associated with the principal to a specific object, access will be Denied despite having an Allow in another policy. In simple terms, Deny always takes precedence over Allow when permissions are assessed.**&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We have discussed multiple ways of controlling access to your S3 buckets using policies within this article. I hope by now, it's clear that you can use all the available policy types to control access to your AWS S3 bucket together.&lt;/p&gt;

&lt;p&gt;Before finalizing, I would also like to highlight some key considerations that you have to keep in mind when planning to use different access control policies.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;When to consider using Identity Based policies,&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;To centrally manage access control methods all within one service.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you manage a large number of buckets and multiple permissions should be added to all those buckets, Identity-based policies will be ideal and easy to manage.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;When to consider using Resource Based policies,&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If you need to granularly control the security of your S3 buckets only within the S3 service itself and within the bucket level, bucket policies can be considered ideal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If your policy file is a bit large, there are size constraints on IAM policies compared to bucket policies (IAM policies can be a maximum of two kilobytes in size for users, five kilobytes for groups, and 10 kilobytes for roles. However, bucket policies can reach a size of 20 kilobytes)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Based on your use case, security, compliance, and regulatory requirements you can leverage all the above access control policies together to achieve the maximum security you can obtain using S3 access control policies.&lt;/p&gt;

&lt;p&gt;Let’s deep dive into other additional security controls and methods provided by AWS S3 in the upcoming articles on this article series.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1 — &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-overview.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-overview.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2 — &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/how-s3-evaluates-access-control.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/AmazonS3/latest/userguide/how-s3-evaluates-access-control.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3 — &lt;a href="https://cloudacademy.com/course/increasing-your-security-posture-when-using-amazon-s3-1235" rel="noopener noreferrer"&gt;https://cloudacademy.com/course/increasing-your-security-posture-when-using-amazon-s3-1235&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>s3</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Understanding inbuilt AWS S3 security controls and methods - Part 1</title>
      <dc:creator>Ravindu Nirmal Fernando</dc:creator>
      <pubDate>Sun, 23 Oct 2022 13:19:44 +0000</pubDate>
      <link>https://forem.com/aws-builders/understanding-inbuilt-aws-s3-security-controls-and-methods-part-1-28ng</link>
      <guid>https://forem.com/aws-builders/understanding-inbuilt-aws-s3-security-controls-and-methods-part-1-28ng</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Originally published on &lt;a href="https://ravindunfernando.medium.com/understanding-inbuilt-aws-s3-security-controls-and-methods-part-1-e549c7d72179"&gt;Medium&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Security is a key component and concept that you should focus on when it comes to data storage. Any misconfiguration in the security front of your sensitive data can bring a catastrophic impact on your business and its customers.&lt;/p&gt;

&lt;p&gt;Since its inception in 2006, AWS S3 has been one of the prominent and go-to storage as a service and backup as a service for many software solutions across the world. Though lots of innovation happening around with AWS S3 service, we still see instances where a simple yet harmful misconfiguration in AWS S3 makes a way for large security breaches (&lt;a href="https://www.zdnet.com/article/unsecured-aws-server-exposed-airport-employee-records-3tb-in-data/"&gt;https://www.zdnet.com/article/unsecured-aws-server-exposed-airport-employee-records-3tb-in-data/&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;As stated in the &lt;a href="https://aws.amazon.com/compliance/shared-responsibility-model/"&gt;Shared Responsibility Model documentation by AWS&lt;/a&gt;, Security and Compliance are shared responsibilities between AWS and the customer. AWS will inherently provide you with physical and environmental security for the services you consume. But when it comes to patch management, configuration management, and awareness and training, the responsibility is shared between both the customer and the Cloud Service Provider (CSP). Hence it's the same with AWS S3 service as AWS is responsible for maintaining the durability, availability, and physical security of data that resides in S3, its the customer’s responsibility to enable and configure the AWS S3 service (buckets and objects) with proper security controls and methods to ensure that the data resides on S3 are secure and cannot be accessed from unauthorized parties.&lt;/p&gt;

&lt;p&gt;AWS has provided its customers with several security controls and methods to improve the security posture when using the AWS S3 service. This article series will go through all those in detail.&lt;/p&gt;

&lt;p&gt;Before we go through the security controls and methods that AWS S3 offers, it’s really important to understand how resource ownership works in AWS S3. That will be the key focal point for part 1 of this article series.&lt;/p&gt;

&lt;p&gt;These are a few points that you should grasp when it comes to principles of resource ownership by default.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Buckets and objects are considered resources in AWS S3. By default, when a bucket is created or an object is uploaded to Amazon S3 the ownership of that bucket and the object will go to the AWS account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can set up permissions to allow another AWS account to upload resources to a bucket created by your account. In such cases, by default, if that AWS account uploads an object resource to that bucket the ownership of that object resource will be with the AWS account which did the upload and not the AWS account that acts as the bucket owner. But this behaviour can be overridden by setting up the permissions in bucket configuration as shown below.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--poPoo7ey--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wgdld01clsf2nlh6srb8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--poPoo7ey--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wgdld01clsf2nlh6srb8.png" alt="Go to Permissions Tab on your S3 Bucket configuration" width="684" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sJXyJ3HE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a2p8cxmhwyy7e84tk6av.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sJXyJ3HE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a2p8cxmhwyy7e84tk6av.png" alt="Scroll down and select Object Ownership" width="800" height="103"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Rki0LJB9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n953picz6giu8ynamjbx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rki0LJB9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n953picz6giu8ynamjbx.png" alt="Edit the Object Ownership setting" width="800" height="503"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;As you can see in the above figure, there are three settings that can be used to control the ownership of the objects uploaded to the bucket.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;ACLs disabled&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bucket owner enforced (recommended) — In this setting ACLs are disabled, and the bucket owner automatically owns and has full control over every object in the bucket. ACLs are no longer considered when assessing permissions to data in an S3 bucket. Bucket policies can be used to define access control. Activating this setting will apply it to all the existing and new objects as well. This setting was introduced in November 2021.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;ACLs enabled&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bucket owner preferred — This setting provides the bucket owner full control over new objects that other accounts write to the bucket with the bucket-owner-full-control canned ACL. If you activate this setting, you should ensure that you set up a bucket policy to grant a specific user or a role to upload objects into that bucket using the bucket-owner-full-control canned ACL. Refer to the sample bucket policy given below,
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Statement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Sid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Only allow writes to my bucket with bucket owner full control"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Principal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"AWS"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:iam::AccountA:role/AccountARole"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"s3:PutObject"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Resource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:s3:::AccountB-Bucket/*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Condition"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"StringEquals"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"s3:x-amz-acl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"bucket-owner-full-control"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Object writer (default) — The AWS account that uploads an object owns the object, has full control over it and can grant other users access to it through ACLs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can read more about these controls by visiting the &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html"&gt;AWS Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For the majority of the use cases, AWS recommends disabling ACLs by choosing the bucket owner-enforced setting and using your bucket policy to share data with users outside of your account as needed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With a solid grasp on the resources and resource ownership in AWS S3, let’s deep dive into understanding security controls and methods provided by AWS S3 in the upcoming articles on this article series.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1 — &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html"&gt;https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2 — &lt;a href="https://aws.amazon.com/premiumsupport/knowledge-center/s3-bucket-owner-full-control-acl/"&gt;https://aws.amazon.com/premiumsupport/knowledge-center/s3-bucket-owner-full-control-acl/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3 — &lt;a href="https://aws.amazon.com/compliance/shared-responsibility-model/"&gt;https://aws.amazon.com/compliance/shared-responsibility-model/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>s3</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
