One of the more complex features of cloud computing is deploying applications to a cloud infrastructure, followed by configuring and managing those applications. Thankfully, these processes are improving as I recently covered in my post about deploying to Microsoft Azure. This week I take a quick tour of how to use the Amazon Web Services (AWS) Elastic Beanstalk offering in conjunction with the previously reviewed AWS Toolkit for Visual Studio. AWS Elastic Beanstalk is an automated way to deploy and manage an application to AWS. The result is a match made in heaven for .NET developers utilizing AWS.
An easy way to the cloud
Let's say you need to deploy a small ASP.NET application to AWS, so you begin the process of setting up the environment -- this means choosing and configuring environment options like capacity provisioning, load balancing, monitoring, and auto-scaling. AWS Elastic Beanstalk (which is in beta) streamlines the process by handling all deployment details of the application container.
Once you having an AWS account set up, you upload your application via Elastic Beanstalk, and everything is configured for you. However, you retain control over the AWS resources behind your application, thus you can change things as necessary. Amazon's marketing team sums it up better than me: "AWS Elastic Beanstalk is easy to begin and impossible to outgrow." Elastic Beanstalk is a free service, so you only pay for the backend services used and nothing related to Elastic Beanstalk.
AWS Elastic Beanstalk is flexible regarding application stacks as well. There is the Apache HTTP for PHP, Node.js, and Python; Tomcat for Java and IIS 7.5/8 for .NET developers. In this post, we focus on the .NET platform.
Connecting Visual Studio to the cloudWith the AWS for Visual Studio Toolkit installed, you can deploy an ASP.NET application to AWS with a couple of mouse clicks. The Publish To AWS option is available by right-clicking a project (and via the Build File menu) as shown in Figure A. Once selected, the dialog box in Figure B is displayed; it allows you to specify the AWS account associated with the application, region, and deployment type. We are focusing on the AWS Elastic Beanstalk, but load balanced and single instance application deployments are options as well. Figure A
The Publish To AWS option makes it easy to deploy applications to AWS. (Click the image to enlarge.)Figure B
Choose Deployment Target when deploying an application to AWS. (Click the image to enlarge.)With AWS Elastic Beanstalk selected as the deployment target, you are presented with options for the deployment environment -- outside of name and URL, you can use the default settings for the other options. Figure C is presented to specify an application name and enter an option description, and you can override the prepopulated version label. The final option at the bottom of Figure C allows you to use incremental code deployment via the Git repository -- this is used when changes are deployed after the initial setup/deployment. Figure C
Enter a name for the application to be deployed. (Click the image to enlarge.)Figure D shows the next step in the process where a name and URL are assigned to the application environment. The Check Availability button allows you to determine if the desired name is available. Figure D
Assign a name and URL to the deployed application. (Click the image to enlarge.)Once the name and URL are established, you can specify EC2 settings or accept the defaults. You can choose Container Type (Windows Server and IIS version since we are using .NET), Instance Type (vm/container size), and security Key Pair (Figure E). Figure E
Define EC2 options for deployment -- be sure to specify IIS version. (Click the image to enlarge.)Also, you can use a custom Amazon Machine Image (AMI) (Figure F). An AMI is a special type of pre-configured operating system and virtual application software that is used to create an EC2 virtual machine. Figure F
Define EC2 options for deployment -- be sure to specify Instance Type. (Click the image to enlarge.)With EC2 set up, the focus shifts to application options. Figure G shows the Application Options window where you can specify the target .NET Framework along with other settings like application monitoring, environment parameters, and credentials. Figure G
Choosing application options for AWS deployment. (Click the image to enlarge.)Figure H is the final window before the actual deployment. This window provides a summary of the options selected and allows you to generate a configuration file and display environment status via the AWS console when the Publish To AWS wizard closes. Figure H
Summary of deployment options for pushing application to AWS. (Click the image to enlarge.)Figure I shows the AWS console for a newly created environment. The Events tab provides a courtside seat to environment setup events like creation of EC2 instance and load balancer configuration. In addition, the other tabs (Monitoring, Resources, Server, etc.) allow you to make changes to the various environment features. The buttons at the top of the console allow you to work with the newly created environment. The Apply Changes button deploys changes to the environment (which is incremental if you use the Git option). The Restart App button recycles the application, and the Rebuild Environment button recompiles the application. The Republish To Environment in Figure A can be used to redeploy the application as well. The Terminate button kills the environment (i.e., deletes it). The Connect To Instance button provides a remote desktop connection to the newly created VMs. Figure I
Examining a deployment environment via AWS Console in Visual Studio. (Click the image to enlarge.)
A point and click path to the cloud
The marriage of AWS Elastic Beanstalk with .NET via Visual Studio provides a straightforward way for developers and organizations to deploy their .NET applications to the AWS cloud. It can be as simple as choosing Publish To AWS and clicking through a few options or as complex as configuring the various options (like instance size) with the beauty of reconfiguring those options post-deployment. Plus, you only pay for what is used.
AWS offers free trials, so take it for a test drive to determine if it fits the needs of you and your customers.
Additional cloud computing resources
For more about cloud computing, check out the ZDNet and TechRepublic special feature Cloud: How to do SaaS right and our downloadable Executive's Guide to Best Practices in SaaS and the Cloud.Keep your engineering skills up to date by signing up for TechRepublic's free Software Engineer newsletter, delivered each Tuesday.
Tony Patton has worn many hats over his 15+ years in the IT industry while witnessing many technologies come and go. He currently focuses on .NET and Web Development while trying to grasp the many facets of supporting such technologies in a production environment on a daily basis.