This course has been updated! We now recommend you take the AWS for Front-End Engineers (ft. S3, Cloudfront & Route 53) course.
Transcript from the "Production Environment Demo Part 2" Lesson
>> Kevin Whinnery: Now we're actually ready to start creating the Elastic Beanstalk application and for that I'm actually gonna go back to the command line. To kind of show you what this looks like end to end, I'm actually gonna clone this project fresh to show you exactly what would happen if you're executing this as we usually do on a continuous integration server.
[00:00:29] These are the steps that would happen to actually deploy this application with the exception of actually initializing the application. So I'm gonna go.
>> Kevin Whinnery: Oops.
>> Kevin Whinnery: So you can see I have practiced this once before, once or twice.
>> Kevin Whinnery: All right, so I'm pulling down the application and when I'm ready to actually start deploying this thing, the first thing I'm gonna do is I'm gonna cd oops.
>> Kevin Whinnery: Into the application directory. And I'm going to type the command like at this point I assume that we have the 8WS CLI installed. And when we do, that's gonna put this eb command on our system path. And this is gonna be the primary way in which we interact with the elastic beanstalk service.
[00:01:38] So the first thing you're gonna do is eb init. And that is going to prompt you for a region in which you would like to deploy our application. In this case, I'll go with US East, Northern Virginia, it doesn't really matter.
>> Kevin Whinnery: And then you can if you already have in a existing Elastic Beanstalk application that you're looking to associate this project with, you can choose that.
[00:02:11] Otherwise you can create a new application which we're gonna do here. All right, in this one we're gonna call todomvc- plusplus which is a good enough default name. And then it's gonna try to detect the type of application you're looking to deploy. So for the Elastic Beanstalk, it supports certain types of applications for deployment.
[00:02:37] Node.js is one of them, I'm gonna say yes. And then it'll ask you if you wanna set up SSH for your instances. Which will allow you to associate the public key on your laptop. With your instances, you can actually SSH into them. You can totally do that if you would like.
[00:02:56] For demonstration purposes I'm gonna say no. And now, we're all set up. The one step that didn't happen for me, because I've already done this, is I was not prompted for my AWS access key and secret. So those credentials that you downloaded from the console before, you'll be prompted to enter those in during the set up process when you do eb init, right?
[00:03:21] So now I have my application created. And now I need to create an environment and this is actually gonna create EC2 instances that will run my application. So, to do that, I'm just going to say eb create.
>> Kevin Whinnery: And it's going to prompt me for an environment name.
[00:03:51] The environment name is generated by default. It's just the name of your application -dev. You can call it whatever you want, but maybe I'll just call it todomvc and not associate it with an environment. And then you can enter a CNAME prefix which is going to be like the public URL for your elastic load balancer which will send traffic to your actual node application.
[00:04:25] todomvc would be fine for that. For the load balancer the classic of classic configuration is going to be fine or we can do either one. And the options are slightly different based on the region. If you did or again like I think there's a different default for instance.
[00:04:51] So now what is happening is something that is actually ultimately going to fail because our application needs a little bit more configuration before it'll actually run. But what's gonna happen is that Elastic Beanstalk is going to provision an environment that we can administer through the admin interface. It's going to zip up the current contents of our application directory.
[00:05:19] It's gonna create a zip file of that. It's gonna upload that archive to S3, and then that archive is actually going to be deployed to the EC2 instances that are being created for Elastic Beanstalk right now. So this is gonna take a little bit, but there's a little bit of information that we can already start to glean from the output here.
[00:05:46] It's creating a new environment for us. So it's already created our S3 bucket and it has created a security group for our elastic load balancer. Which is not something we care about. Because we're actually more interested in the security group for the Elastic Beanstalk instances themselves, which we'll be able to get at the end of this process.
[00:06:14] So this does take awhile. So this would be a good point if you want to continue along your journey. If you've already downloaded your credentials, going into your application project directory, doing eb init. Going through the motions of initializing your application project and then doing an eb create to create an environment to actually deploy our application to you.
[00:06:44] So got the environment going. Again this is gonna take take a little bit. But the thing that we would like to see get created is a security group for our actual Elastic Beanstalk instances. So once we have that, then we can create the RDS instance, which is actually gonna talk to.
[00:07:11] That our instances are actually going to talk to, our EC2 instances.
>> Kevin Whinnery: So what did the zero say to the eight? Anybody know this one? Nice belt, yes. Be here all week. All right, so now we can see that an actual EC2 instance has now been created with this identifier.
[00:07:47] By default we're only gonna have the one instance created that we can deploy our application to.
>> Kevin Whinnery: All right, so we've got our auto-scaling group created, the instances being added to it. Checking, checking, checking.
>> Speaker 2: So it says safe to Ctrl+C but what will happen at this point if you did that, you'd have to start over right?
>> Kevin Whinnery: No it would keep going, the logs are still being piped like if we Ctrl+C this, we could actually go into the console. Which maybe will do right now. If we go to the Elastic Beanstalk console, we can see that the todomvc environment is gray because it's still initializing.
[00:08:40] But we could kind of view the logs and see what's happening there.
>> Kevin Whinnery: Good, we do have our security group already a must in this step.