Learn .NET Web application deployment using AWS Elastic Beanstalk:
We gained knowledge on AWS CodeDeploy in our previous tutorial.
AWS Elastic Beanstalk is primarily a deployment service which helps to deploy your application quickly to different environments on the cloud.
Read Through => Simple DevOps Training Series
AWS Elastic Beanstalk is more of a PAAS offering that is provided to the developers wherein they need not worry about the infrastructure to deploy and launch the web application.
AWS Elastic Beanstalk keeps a track of all the application versions deployed and helps to roll back to any specific older version.
In this tutorial, we will see how an ASP.NET web application can be deployed to AWS Elastic Beanstalk.
For this, I have used Visual Studio.NET 2015 and another pre-requisite which is AWS toolkit for Visuals Studio .NET which also needs to be installed into the IDE.
A similar process can also be followed for deploying any J2EE application (WAR file) into the AWS Elastic Beanstalk by installing AWS Toolkit for Eclipse (Luna version or higher). This service also supports other technologies like Python, Ruby, and also supports deploying web applications from containerization platform like Docker.
What You Will Learn:
Installing AWS Toolkit into Visual Studio.NET IDE
Before you can deploy any ASP .NET web application to AWS Elastic Beanstalk you will need to download and install the toolkit for a specific version of Visual Studio.NET (2013, 2015, and 2017) from the Amazon site.
Double click on the MSI executable file and download from the above URL to install the same to your Visual Studio .NET IDE.
Publish Process of ASP.NET Web Application
Given below is the Publish Process of ASP.NET Web Application to AWS Elastic Beanstalk.
#1) Launch and create a Visual Studio.NET
ASP.NET Web Application project => Web Forms
#2) Click OK.
As the toolkit is now installed to the IDE, you are now ready to publish to AWS Elastic Beanstalk. Before you are about to publish, modify the Default.aspx file as shown in below figure. The contents can be validated and displayed on the web app once deployed.
#3) Before publishing AWS Elastic Beanstalk it is good to know the process involved here.
The publishing process involves creating an application, which is a collection of versions and environments, upload a new version of the build and deploy it to the appropriate environment (development, QA, Staging etc…) using container type of IIS web server.
Once deployed, AWS Elastic Beanstalk takes care of provisioning the EC2 instance, scaling, load balancing and of course monitoring of the application.
In case if you have an existing application already created with the environment then you can use the same as well during the publishing process. The process will also need an IAM user to be created with Elastic Beanstalk permissions. The access key and secret key will need to be provided.
Since the ASP.NET web application is now created, we can start the publish process to AWS Elastic Beanstalk by right-clicking on the project and selecting “Publish to Elastic Beanstalk” as shown below.
#4) As a part of any Continuous Integration activity, all of these projects would normally be stored in a version control repository like TFS or GIT with the developers modifying and committing the code to this shared repository. Post this the deploy process would be invoked as shown below.
#5) We will start by selecting to create a new application and environment. Click on the user icon to add any profile name with the IAM user Access and secret key.
#6) Click OK to proceed and Next to continue with the environment creation and instance provisioning.
#7) In this screen, provide an environment name as per the naming conventions followed for dev, QA, staging etc. Also, note the URL that will be used to test the application post the deploy.
#8) Click Next.
Since every deployment would consist of different environments as described above it is very important to select the type of instance for these environments considering the need to finally deploy to a production environment.
Hence you can select instances type which would be on parity with a production like environment. This is shown in the next screen along with the container type of deployment selected which is IIS 10.0.
#9) Click on Next to proceed with the final step of deployment.
#10) Click on Deploy.
Once completed you can launch the Elastic Beanstalk console and look at the application being deployed with the application and environments entered. As and when a code is modified the application versions would also be created on the successful deploy.
#11) Launch the URL as displayed on the top right to test the application deployed.
#12) Hence in reality deployment would need to be done to multiple environments using the above process before making it finally available in the PRODUCTION environment. In case of issues with any of the builds, you can also roll back to any previous versions using the AWS Elastic Beanstalk console.
AWS Elastic Beanstalk is a good and quick way of deploying and monitoring web applications built using .NET or Java/J2EE technologies or using the other technologies supported without really worrying about the infrastructure availability.
In this short tutorial, we have seen how easy and quick it is to deploy a .NET application to the AWS Elastic Beanstalk and most importantly by keeping the concepts of DevOps (Continuous Integration and Continuous Delivery) in mind.
In my earlier tutorials, we have also seen how AWS Cloud can be used to deploy Java/J2EE web applications as well using AWS CodeCommit, CodeBuild, and CodeDeploy services.
Check our upcoming tutorial to know more on DevOps Ansible Tool. Ansible is an open source tool that helps in task automation, application deployment, cloud provisioning and configuration management.