1
00:00:00,180 --> 00:00:07,350
In this video, we are going to create Amazon S3 bucket with using the aid package from our Node.js

2
00:00:07,350 --> 00:00:08,220
application.

3
00:00:08,220 --> 00:00:13,380
For that purpose, we will use Create Bucket Command into S3 client object.

4
00:00:13,410 --> 00:00:18,480
If you open the reference documentation, you can see the details of the Create Bucket Command, and

5
00:00:18,480 --> 00:00:22,500
if you scroll down, you can see the an example usage of the Create Bucket Command.

6
00:00:22,500 --> 00:00:29,400
So in this stage we can check the input and output parameters to see the parameters and which data will

7
00:00:29,400 --> 00:00:30,300
be returned back.

8
00:00:30,300 --> 00:00:35,370
So input parameters, if you open the input class, you can see these are the input input parameters

9
00:00:35,370 --> 00:00:38,370
that we can provide when creating a bucket.

10
00:00:38,370 --> 00:00:41,400
I'm going to use and send only bucket information.

11
00:00:41,400 --> 00:00:46,230
And in the output parameter you can see that this time we have only location information.

12
00:00:46,230 --> 00:00:49,530
That is the location of the created S3 bucket.

13
00:00:49,650 --> 00:00:55,190
So let's implement these create bucket command into our Node.js application, open the visitor code

14
00:00:55,200 --> 00:00:59,460
and create a new JavaScript file, which is the create bucket JavaScript.

15
00:00:59,460 --> 00:01:02,700
And in this file basically we will apply the same steps.

16
00:01:02,700 --> 00:01:09,120
We have a run method and in this run method we are using the S3 client to send operation and this time

17
00:01:09,120 --> 00:01:14,700
we are sending the create bucket command and this command is required some parameters and parameters

18
00:01:14,700 --> 00:01:15,450
in here.

19
00:01:15,480 --> 00:01:21,630
We basically only give the bucket name as a parameters and paste these parameters to create bucket command.

20
00:01:21,630 --> 00:01:28,170
And this will be sent from the S3 client object to interact and create bucket from the S3 object in

21
00:01:28,170 --> 00:01:29,640
our squad environment.

22
00:01:29,640 --> 00:01:34,170
And this is the available operation that is returned back to async operation.

23
00:01:34,170 --> 00:01:40,680
We can use these async await keywords and after getting the successful response that has including the

24
00:01:40,680 --> 00:01:41,910
location information.

25
00:01:41,910 --> 00:01:49,230
So that's why we are right down and logging the location of the response of created a S3 bucket.

26
00:01:49,230 --> 00:01:53,010
So this is the implementation and that's why we have important this statement.

27
00:01:53,010 --> 00:01:59,700
So client is the fixed object that is a separate client object Node.js modules that we are using this

28
00:01:59,700 --> 00:02:03,390
and this time we will use create bucket command in our example.

29
00:02:03,390 --> 00:02:10,170
To run this example, please open the terminal and come to correct directory and run the node.

30
00:02:10,170 --> 00:02:11,820
Create bucket command.

31
00:02:11,850 --> 00:02:14,370
Create bucket JS file hit enter.

32
00:02:15,900 --> 00:02:18,600
As you can see that we got exemption.

33
00:02:19,050 --> 00:02:23,010
You can see the zip code is for ore.

34
00:02:23,010 --> 00:02:29,070
And if you see the code, which is the invoice bucket name, so that means the bucket name is not valid.

35
00:02:29,070 --> 00:02:32,130
For our example, maybe this character is not allowed.

36
00:02:32,130 --> 00:02:34,230
So I'm going to change with the dash.

37
00:02:34,950 --> 00:02:40,380
And also I would like to give some random number to make it unique.

38
00:02:40,380 --> 00:02:46,620
Bucket name should be unique and that's why please change the bucket name and after that run this command

39
00:02:46,620 --> 00:02:49,740
again, not create bucket and hit the enter.

40
00:02:51,590 --> 00:02:58,520
See that this time we got the success response and this is the address of our bucket and we can verify

41
00:02:58,520 --> 00:03:00,920
this bucket from the measurement console.

42
00:03:00,950 --> 00:03:09,470
If you open the management console, open the three buckets, see that we have successfully create the

43
00:03:09,470 --> 00:03:13,460
bucket with using the SDK package.

44
00:03:14,390 --> 00:03:18,560
As you can see that this bucket is placed on our environment.

45
00:03:18,590 --> 00:03:23,150
In the next video we are going to upload a file into our Amazon S3 bucket.
