Detailed Notes
We continue the series of tutorials as we build out a backup system that drops archive files into Amazon's S3 and related storage. This episode gets us started with the Boto3 library and AWS command line interface in a practical sense as we navigate creating a bucket in S3.
You can find out more through our online classes at https://school.develpreneur.com and register for free. Registration will add you to our email list and you will periodically receive coupons for courses as well as notifications of the latest releases.
Transcript Text
[Music] uh in a sense oops let's flip back over here and so I've got very simple examples now all what we're going what we're going to do is we're going to go in here we're going to do create a bucket and you can find that as well so what I'm going to do is let's just go ahead and Tack that onto it and so now what we're going to do is we're going to come over here and I'm going to put it because I'm going to do some copy and paste because that'll be a little easier to work in the little place I'm working so uh here let's see that's hello S3 I don't need oh so now what I'm going to do is I'm going to do instead of hello S3 oh that was already there there we go there's the first one and I want create oh because it pushed it over on me so now what I'm going to do is I'm going to create a bucket and um it's going to be a default region uh if that works and and then uh so I'm going to come in here I'm going to do uh so it's going to do oh so it's in s. bucket name so I want to do this I'm going have to give it a bucket name let's see I don't need region override uh I don't really need a logger but we'll keep that anyways let's go ahead and set that up uh created that if I look [Music] here so what they've got here is they've got a bucket and a name that they're using we're going to just call it I think we just want a bucket right yeah bucket. name and bucket so self. bucket um so do bucket create which is oh it's a high Lev resource and build that wraps actions in a class-like structure so the bucket is going to be um let's do this well let's actually do it this way we're just going to connect because that's what we did before where did I go uh we do the hello we're going to do this and let's see so create and we're going to try this and if we do that then that should be okay if we region override we have to worry about that uh region equals this bucket we don't need a sell let's just we're not going to worry about a logger right now so we're going to print and we're going to print here wh wow that totally got messed up nice little typo okay print uh blah blah blah bucket. name and there we go so let's see oh we don't need that to be self and let's call this create bucket so now if we take that let we go over here and then what we're going to do is we'll just paste that in so we've got to create bucket and then we're going to come in here and we're going to call create bucket and we don't need an override oops we do need a Comm up there wonder if that typo came across there too uh that is bucket name is create that wait till exists created a bucket in region let's see if this will do what we need it to otherwise I may have to let's go back over here did that have that Z yeah I did so we need to take that and then we also need this to be that's going to be bucket uncore name and let's see what we do so we take this and now we're going to create a bucket and we're going to call it um we're going to call it um our backups don't think it's going to like that because bucket names have some issues but we're going to find out in just a second so if we try to run it uh specified bucket is not valid and so that's happening on the bucket. create and it's most likely uh let's see did it tell us uh client errors not oh we've got something messed up there oh let's just do this let's just call it error uh it couldn't do that let's see if it's going to try to tell us where it did see if we can do it this way is it going to tell something little different nope oh I think that's going to be I think we need that to be exception oh we probably need the errors because it probably isn't going to like that yeah there we go so I couldn't create that bucket in that region oh interesting oh our backups in East one let's see why that couldn't be um um we did that oh CU it doesn't like that bucket that's the region so let's take a look real quick uh we come in here so let's go look in the create bucket so here we go uh so there is uh create bucket bucket oh that's in the API oh that is so it should be if we look at client. create bucket uh so we probably want that so we want actually um we probably want this to be what we want there and then we want oops oh we've got that okay so that's [Music] S3 uh s3. create actually we probably don't need that at all and let's see there's region let's do S3 dot uh what did we call that uh create bucket is that the [Music] client yeah so we want this to be client which means create bucket that's going to be there whoops and then uh that needs to be well it was getting it so let's go back and look at that okay so let's do this that's the bucket create bucket. name equals bucket name bucket. wait till exists um that's probably good uh is that going to work that should be our create bucket oh is it going to give us a client error probably not okay let's just do an [Music] exception if we take that oh let's just do this where'd it go say quit this is going to be create bucket name is going to be actually be let's do DP um tutorial backup let's try that so now if we run it they have a required parameter not set so the name here and it's there on 57 oh so there does need to be a name okay and then so we don't need that and specified bucket is not valid so let's go look at that real quick um I bet so if we go look then we're going to find find that uh let's try that again um yes I'm not a robot let's try this again so here's ours it says create bucket let's go look here oh let's take this actually let's take all three of these actually let's take this whole section we just do it this way we are going to steal that thing and let's do it like this so that's really our create bucket right yep bucket name Regent so okay so now let's see if this gives us something a little better uh that should work so now if we run it there we go and uh it still tells us that the specified bucket is not valid let's go look here again Okay naming standards here we go uh lowercase characters numbers periods that's probably so here's probably your issue let's do this and we're going to come in here oh one too many of those we're going do that so that we know what our name's supposed to be so now if we call it here this is going to be um we're going to call this backup repository oh tutorial because you do need something sort of complex so we're going to go with that uh is that too long 3 and 63 uh each label cannot contain underst stores in with a dash or can have consecutive periods use dashes adjacent to periods so we can do it like this so we could call it uh where do we do it this is probably the hardest part is actually naming your bucket so let's do that uh let's let's leave it to a default and see if that works and then I bet we will and there we go and then here is our backup so it took a little bit of work uh but we did get there so if we now see wh if we do this and we just get rid of the create because we're going to actually drop this whole thing anyways now we'll see here's our buckets here and I think that's good enough for now we're going to come back into the next one sorry if we got a little bit out of sorts I want to make sure it was configured that is one of the things you will run into sometimes the configuration can be a little bit of a pain but what you want to do is be able to create your bucket because then the next time we're going to come around we're going to start actually putting stuff into that we're going to grab files and we're going to store them out there hope this is helpful for you as always shoot us an email at info developer.com if you have any questions other than that go out there and uh check this stuff out so go have yourself a great day a great week we will talk to you next [Music] time
Transcript Segments
[Music]
uh in a sense oops let's flip back over
here and so I've got very simple
examples now all what we're going what
we're going to
do is we're going to go in here we're
going to do create a bucket and you can
find that as well so what I'm going to
do is let's just go ahead and Tack that
onto
it and so now what we're going to do is
we're going to come over
here and I'm going to put it because I'm
going to do some copy and paste because
that'll be a little easier to work in
the little place I'm working so uh here
let's see that's hello S3 I don't need
oh so now what I'm going to do is I'm
going to
do instead of hello S3 oh that was
already
there there we go there's the first
one and I want create oh because it
pushed it over on
me so now what I'm going to do is I'm
going to create a
bucket and um it's going to be a default
region uh if that works and and
then uh so I'm going to come in here I'm
going to
do uh so it's going to do oh so it's in
s. bucket name so I want to do this
I'm going have to give it
a bucket name let's see I don't need
region override uh I don't really need a
logger but we'll keep that
anyways let's go ahead and set that
up uh created
that if I look
[Music]
here
so what they've got here is they've got
a bucket and a name that they're using
we're going to just call it I think we
just want a bucket
right yeah bucket. name and bucket so
self.
bucket
um so do bucket
create which
is
oh it's a high Lev resource and build
that wraps actions in a class-like
structure so the bucket is going to
be um let's do
this well let's actually do it this way
we're just going to connect because
that's what we did before where did I go
uh we do the
hello we're going to do this
and let's see so
create and we're going to try
this and if we do that then that should
be okay if we region override we have to
worry about that uh region equals this
bucket we don't need a sell
let's just we're not going to worry
about a logger right now so we're going
to
print and we're going to print
here wh wow that totally got messed up
nice little typo okay print uh blah blah
blah bucket.
name and there we go so let's
see oh we don't need that to be
self and let's call this create
bucket so
now if we take
that let we go over
here and then what we're going to do is
we'll just paste that in so we've got to
create
bucket and then we're going to come in
here and we're going to call create
bucket
and we don't need an override oops we do
need a Comm up
there wonder if that typo came across
there
too uh that is bucket name
is create
that wait till exists created a bucket
in
region let's see if this will do what we
need it to otherwise I may have
to let's go back over here did that have
that Z yeah I
did so we need to take that and then we
also need this to
be that's going to be bucket uncore name
and let's see what we
do so we take this and now we're going
to create a bucket and we're going to
call it
um we're going to call it um our
backups
don't think it's going to like that
because bucket names have some issues
but we're going to find out in just a
second so if we try to run
it uh specified bucket is
not valid and so that's happening on the
bucket.
create and it's most
likely uh let's
see did it tell us uh client errors not
oh we've got something messed up there
oh let's just do
this let's just call it
error uh it couldn't do that let's see
if it's going to try to tell us where it
did see if we can do it this way is it
going to tell something little
different
nope oh I think that's going to be I
think we need that to be
exception oh we probably need the
errors because it probably isn't going
to like
that yeah there we go so I couldn't
create that bucket in that region oh
interesting oh our backups in East
one let's see why that couldn't be um um
we did
that oh CU it doesn't like that bucket
that's the
region so let's take a look real
quick uh we come in
here
so let's go look in the create
bucket so here we
go uh so there
is uh create bucket
bucket
oh that's in the API oh that is so it
should
be if we look at client. create
bucket uh so we probably want that so we
want
actually
um we probably
want
this
to be what we want there and then we
want
oops oh we've got
that okay so that's
[Music]
S3 uh s3.
create
actually we probably don't need that at
all and let's see there's region let's
do S3
dot uh what did we call that uh create
bucket is that the
[Music]
client
yeah so we want this to be
client which means create bucket that's
going to be
there
whoops and
then uh that needs to
be well it was getting it
so let's go back and look at
that okay
so let's do
this that's the bucket
create bucket.
name equals bucket
name
bucket. wait till
exists um that's probably
good uh is that going to work that
should be our create bucket
oh is it going to give us a client error
probably not
okay let's just do an
[Music]
exception
if we take that oh let's just do
this where'd it
go say
quit this is going to be create
bucket name is going to
be actually be let's do
DP um
tutorial
backup let's try
that so now if we run
it they have a required parameter not
set so the
name
here and it's there on
57 oh so there does need to be a name
okay
and then so we don't need
that and specified bucket is not valid
so let's go look at that real
quick um I
bet so if we go look then we're going to
find find that
uh let's try that
again um
yes I'm not a
robot let's try this
again
so here's ours it says create
bucket let's go look here oh let's take
this actually let's take all three of
these actually let's take this whole
section we just do it this
way we are going to steal that thing
and let's do it like
this
so that's really
our create bucket right yep bucket name
Regent so okay so
now let's see if this gives us something
a little
better uh that should
work so now if we run it there we go and
uh it still tells us that the specified
bucket is not
valid let's go look here
again Okay naming standards here we
go uh lowercase characters numbers
periods that's
probably so here's probably your issue
let's do
this and we're going to come in
here oh one too many of
those we're going do that so that we
know what our name's supposed to be so
now if we call it
here this is going to be um we're going
to call this
backup
repository oh tutorial
because you do need something sort of
complex so we're going to go with that
uh is that too long 3 and
63 uh each label cannot contain underst
stores in with a dash or can have
consecutive periods use dashes adjacent
to periods so we can do it like this so
we could call it uh where do we do
it this is probably the hardest part is
actually naming your bucket so let's do
that uh let's let's leave it to a
default and see if that works and then I
bet we
will and there we go and then
here is our
backup so it took a little bit of work
uh but we did get there so if we now see
wh if we do this and we just get rid of
the create because we're going to
actually drop this whole thing
anyways now we'll see here's our buckets
here and I think that's good enough for
now we're going to come back into the
next one sorry if we got a little bit
out of sorts I want to make sure it was
configured that is one of the things you
will run into sometimes the
configuration can be a little bit of a
pain but what you want to do is be able
to create your bucket because then the
next time we're going to come around
we're going to start actually putting
stuff into that we're going to grab
files and we're going to store them out
there hope this is helpful for you as
always shoot us an email at info
developer.com if you have any questions
other than that go out there and uh
check this stuff out so go have yourself
a great day a great week we will talk to
you next
[Music]
time