This is the second part of the series about the Elastic Beanstalk service from Amazon Web Services.
In the first part we discussed how Elastic Beanstalk can help developers launch quicker applications.
VMware Training – Resources (Intense)
In this second part of the series we will see how an application is launched, how to check that it was launched correctly and how to launch another environment based on a saved environment configuration.
So let’s start deploying an application using Elastic Beanstalk.
From the AWS Management Console, from the “Compute” section, select “Elastic Beanstalk”:
Because there is no application created yet, the only thing you can do is create a new application. From the top right section of the page select “Create New Application”:
This will start the wizard. In the very first step you will need to provide a name to your application and a description if you want to:
There are two types of environments that can support web applications. Because this is for testing purposes, we will use a web server environment:
The wizard continues with selecting the environment—that is the programming language that will be used—and the environment type. For the programming language we will use PHP though there are plenty of other options that cover most of the commonly used programming languages for web applications. As for environment type, you can deploy the application on a single instance, as we are, or you can deploy it with autoscaling and load balancing features that AWS provides to customers.
As we don’t have our own application, we can use the sample application that Elastic Beanstalk provides:
Next you will need to provide a name and URL for your environment. The URL has to be unique and you have the option to test if the URL is available:
Optionally you can create RDS DB instances for this environment and you can create the environment in a specific VPC if you wish to. We will not use any of these options for this example however.
Because you will start the application on an EC2 instance, you will need to provide some details about the EC2 instance type and the key pair. You can also add an email address where notifications about the status of the environment will be sent:
On the same “Configuration Details” page you can provide information about the root volume type of the EC2 instance:
You can create tags to distinguish your environments:
Then, you will need to link an instance profile with a service role. If no role is created, then you will be redirected to a page where you will allow the permissions to the role to access the resources needed by Elastic Beanstalk:
This is the new page opened where you can see the IAM role created:
The last step of environment creation is to review the configuration, and if everything looks fine, then the configuration can be launched:
Once you launch the environment, you can see what is going on in the dashboard:
Select “Events” to see what happened during the environment launch. As you can see, in our case, the launch was finished and the environment is ready for us. Actually, this will take several minutes based on your configuration:
Now on the dashboard, you can see that everything looks good:
This is the EC2 instance launched to support our application:
Remember that during the environment configuration we had to choose an environment URL that had to be unique. This is what is seen when that URL is accessed. This is the index page of the sample application that Elastic Beanstalk provides to users in order to test the service if they don’t have their own application. Seeing this means that Elastic Beanstalk launched our application properly:
You can see the environment configuration by using “Configuration” menu from the application:
As mentioned, you have the ability to launch multiple versions of the same environment. In this case, we will save the current environment and then launch another one. Then you can modify the new environment based on your needs.
So from the top right “Actions” menu, select “Save Configuration”:
Provide a name for the current environment configuration and optionally a description:
From the Elastic Beanstalk homepage select the application (web-app in our case) and in the “Saved Configurations” menu you will see the configuration that we just saved:
This is actually a file that is saved in the S3 bucket created when the application is created. The location should be something like this:
You can launch a new environment now. On the Elastic Beanstalk homepage, from the top right “Actions” menu, select “Launch New Environment”:
On the environment type you will need to provide the name of the configuration that was saved earlier:
The rest of the process is the same as when we launched the first environment. You will need to provide another environment URL for the new environment though.
After a few minutes, the new environment will be ready for use:
Now here are the two environments:
And we can continue to make more. You can make the modifications needed to the new environment, save it and then later launch another environment.
To terminate the environment, use the top right “Actions” menu and choose “Terminate Environment”:
To delete the application and all possible environments, you need to select “Delete Application” from the top right “Actions” menu of the application page:
And that would be all about how you can deploy a new application, then save the current environment and later on launch another environment based on the saved configuration.
We also saw how to terminate an environment and how to delete an application.
As you can see, the process is pretty straightforward and there are not that many options that you can configure. The harder part is on the developer who needs to create the application on the environment launched by Elastic Beanstalk.
Throughout the series we saw the power of Elastic Beanstalk and how it can provide a development platform at will so that application developers will not need to spend time building the platform development.