Transcript from the "Automating Buckets at Scale" Lesson
>> So I'm gonna go ahead and just get a little bit more of just showing you guys the power of this while you guys add. And for chat as well, if you guys can get your AWS credentials added to your shell environments, just to make sure that we can start creating resources in AWS as well.
[00:00:19] And while you guys are doing that, so I want to showcase a little bit more of even what you can do with this. Because again, I know I'm showing you just like very simple programming things, but when you look at it from solving problems as DevOps, it's very, very powerful.
[00:00:35] So let's think about quickly DevOps at scale, right? I need hundreds of buckets, right? And am I just gonna have developers copy and paste this over and over, even just like I just showed you, is that what we really want? Probably not. [LAUGH] And the reality of this is, what we can do, again, because we're leaning on code, is we can just simply say, you know what, buckets = this, right?
[00:01:05] And then just create a simple for loop. I think I did that right, is it, where's it again? Yeah, and so now, We just paste this in, right, bucket. And if we wanted to, we could even say, okay, you know what, buckets is typed as well, so BucketList.
[00:01:35] And in this, let's say it's an array, and it has the name. Actually, I'm a dummy, we don't even need to do this. We could just simply say FmBucket, right? Because we wanna be able to reuse the definition or the DSL that we've already created. So what we can do is, is we could say, all right, well, to create all of my buckets, I'm going to make a, and actually, this is supposed to be a const, sorry, const bucketList.
[00:02:12] I have been working in go too much. There we go, there. So now, I have a list that I can easily pass to this. And so if I do bucketList, right? And here's the fun part, this is like this doesn't even need to be in the same file.
[00:02:34] You could have a file, I don't know what just happened to my editor, but you could have a whole file of just variables and then export that variable and then reuse it over and over. So let's try it one more time for bucket of bucketList, right, in, sorry, in.
[00:02:57] Go up here, cut this, paste this like this, and then bucket. Yeah, so we'll do this, FmBucket. [LAUGH] go, yeah, of course. Cool, so now if I wanted to, I could say, all right, well, I need a bucket for, Let's say, example-1. And there's interesting things that we could do with this, right?
[00:03:37] We could say, you know what, we do want the product here, right, maybe we do want the product here. And so we could do that, or we could simply say, this is all gonna be a part of the same product, so we'll logically scope this like this, right?
[00:03:49] And then we'll just say example-1, example-2, right? And then just go here and say, you know what, it's always gonna be the same product, right? So for now, I can, Just do this and simply just change the name. Oops, I'm not gonna do all that, but you get the idea.
[00:04:18] And so now, if we go here, and then we do up. And what's interesting is outside of the broken words because I didn't give it the right variable, you'll notice that it's isolated, right? devops-course-1 has its own component with its own resources in it, and devops-course-0 has its own component with its own resources in it, right?
[00:04:41] And again, when you're talking about say, for example, how do I manage all of my buckets in my infrastructure and make sure that if I wanna add a new bucket, I can just add it to a repository and let it run automation? Just showing you how to do that.
[00:04:56] And this is literally what we use at my company as well. We have actually a repository full of buckets and stuff like that. And if we need a new bucket, we can easily add it there.