From the course: AWS for Developers: S3

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Deleting a bucket

Deleting a bucket - Amazon Web Services (AWS) Tutorial

From the course: AWS for Developers: S3

Start my 1-month free trial

Deleting a bucket

- [Instructor] All right, we're coming in the home stretch here with Java, 'cause as you've seen, when we create buckets in code, often time we need to clean up after ourselves. If you haven't noticed, we've had to do some cleanup. So let's go ahead and get that process done now, programmatically, with the Java SDK. Jump back into our application class, and we will create a new void message called deletebucket. We're going to need to have a bucket for that. Put our try block in here, and surprise, surprise. Once again, we will use a builder to generate our request. This really is a solid way to build requests. This is a great pattern, and I'm glad that Amazon did it this way. So, passing the bucket to the builder, and then we will call deletebucket, and pass it in our request. Add in our catch block, and back down at our main message, we'll get rid of the pre-signing, and we can simply delete our transient bucket at…

Contents