In this video, we are going to develop the list bucket command in our Node.js application.
For that purpose, please, we should do a code and create a native JavaScript file, which is the list
bucket that goes into our lecture folder.
And after that please implement these raw method.
This is the boilerplate method we will implement in this video.
So basically we will create a run method, which is the asynchronous method that is using the available
client send method operation to perform S3 interactions for listing bucket.
And after that we will run this method in our JavaScript file.
So let me implement this to do part.
Basically, we will use S3 client object and send the command of the list bucket command.
In order to do that, I'm going to write these two lines of code.
Please save this file.
Of course we should pay.
We should cover the tri cage block.
If there is an error, we should catch these error during the S3 communication.
But the important part is we are using S3 client object and sent to list bucket command.
And this list Bucket Command has no any parameters.
So that's why I didn't create any parameters yet.
And after returning any data, we are listing the buckets, data, bucket, subject and log this operation.
So before running these methods, these JavaScript file, we should record edit the required import
statement into our JavaScript file.
For example, we used list bucket command.
If you come here and click the control space and click this command, this will be import list buckets
command from the client S3 package.
And after that we should import the S3 client.
As you know that we have created a separate Node.js module that we can use these S3 client object for
that purpose.
I'm going to use this client package, but this time it is not showing for me for that purpose.
Please write this import statement manually.
And in this stage the important part is please don't forget that that JS file.
Otherwise it can be c these separate Node.js module.
So make sure that you have import these two statements and after that our code is ready to run with
using the S3 client and sending the list bucket command.
Save this file and open the terminal.
Go to the correct location and run the node command in our local computer with pasting the our list
pocket JavaScript file hit enter.
So as you can see that it is getting a success response.
And on my computer on my a the Willis Cloud environment I have one S3 bucket and that's why we will
see the name and creation date.
But if you don't have any bucket on your Willis account, you don't see any bucket, but at least we
get the success response.
That means we can list the buckets correctly and be expected.
So in the next video we will create an Amazon S3 bucket.