AWS

3 Mins Read

Conditional Writes Now Supported on Amazon S3

Voiced by Amazon Polly

Conditional Writes: An Overview

Conditional writes, which verify an object’s existence before creating it, are now supported by Amazon S3. With this feature, you may more easily stop apps from overwriting any existing objects when you upload data. PutObject or CompleteMultipartUpload API calls can be used for conditional writes in directory and general-purpose buckets, in conjunction with the HTTP if-none-match conditional header to enable conditional writes.

Customized Cloud Solutions to Drive your Business Success

  • Cloud Migration
  • Devops
  • AIML & IoT
Know More

Step 1 - Create S3 Bucket

Assuming you have an AWS user with permission to create s3 bucket and putObject permissions, also  aws cli configured on your local machine or you can use aws cloudshell to perform the below operations:

Figure 1: create s3 bucket

To view the bucket goto s3 and type the name of the bucket you created:

Figure 2: view created s3 bucket

Step 2 - Upload an Object in S3

To upload an object with the key named HappyFace.jpg, take any file image file on your local machine, rename it to HappyFace.jpg, and upload the same using the below command.

Figure 3: Upload a object using s3 aws cli

To view the uploaded object get into your s3 bucket

Figure 4: view the uploaded object

Step 3 - Upload Object Again with Same Key and without Conditional Write

Now, when uploading object with the same key named HappyFace.jpg, it will overwrite the existing object

Figure 5: upload the object with same key

Figure 6: view the uploaded object overwritten existing object

We can see in the above image the time of the object when the “Last Modified” got updated, in Figure 6, as compared to object in Figure 5.

Step 4 - Upload the Object Again with Same Key and with Conditional Write

Now if we upload an object with the same key, with conditional write, the putObject operation will fail as the specified pre-condition does not hold, as object with already exists

Figure 7: Uploading the with object with Conditional Write

Step 5 - Delete the Created Resources

Delete the object HappyFace.jpg and remove the bucket.

Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.

  • Cloud Training
  • Customized Training
  • Experiential Learning
Read More

About CloudThat

CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training PartnerAWS Migration PartnerAWS Data and Analytics PartnerAWS DevOps Competency PartnerAWS GenAI Competency PartnerAmazon QuickSight Service Delivery PartnerAmazon EKS Service Delivery Partner AWS Microsoft Workload PartnersAmazon EC2 Service Delivery PartnerAmazon ECS Service Delivery PartnerAWS Glue Service Delivery PartnerAmazon Redshift Service Delivery PartnerAWS Control Tower Service Delivery PartnerAWS WAF Service Delivery Partner and many more.

To get started, go through our Consultancy page and Managed Services PackageCloudThat’s offerings.

WRITTEN BY Kamlesh N

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!