Thursday, January 12, 2017

Deploy a Classic ASP Application using AWS Elastic Beanstalk

The default IIS/Windows Environment provided by the Elastic Beanstalk will not have ASP enabled. In this tutorial, you will learn how to deploy a Classic ASP application to AWS Elastic Beanstalk. However this article can be used as reference to host any application in AWS Elastic Beanstalk which requires the customization to the Environment(like enable asp, Install Oracle driver etc).

Creating customized AWS Elastic Beanstalk Environment has 3 major steps:

       I. Create Elastic Beanstalk AMI.
    II.  Create custom AMI and customize.
 III.  Create Elastic Beanstalk Environment using custom AMI.


I. Create Elastic Beanstalk AMI

We need to create  Elastic Beanstalk AMI because Non-Beanstalk AMIs are not supported for Elastic Beanstalk Windows Server platforms.
  1. Create a IIS/Windows Environment following AWS Document.
    Please follow only steps under "Create the Environment". Also in step 9 don't choose "Create an RDS DB instance with this environment". If you need a database we can do it in Step III.
  2. Note down the "Custom AMI ID" of the environment created in the about step by navigating to Configuration - > Instances
    [Screen]
  3. Terminate the Environment by Clicking Actions - > Terminate Environment
II.  Create custom AMI and customize

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
  2. Choose Launch Instance.
  3. Choose Community AMIs
  4. Enter the AMI ID of the Elastic Beanstalk(Created in Step I) that you will customize to create a custom AMI and press Enter.
    [Screen]
  5. Choose Select to select the AMI.
  6. Select an instance type and choose Next: Configure Instance Details.
  7. Proceed through the wizard to launch the EC2 instance. When prompted, select an key pair that you have access to so that you can connect to the instance for the next steps.
  8. Connect to the instance with RDP[link to how to rdp].
  9. Perform any desired customizations.
    Like
    Enable ASP by following steps in Microsoft site
    https://www.iis.net/learn/application-frameworks/running-classic-asp-applications-on-iis-7-and-iis-8/classic-asp-not-installed-by-default-on-iis
    Copy the ASP code to the root directory - If you know how to upload asp code to EBS then do this in the step III.
    Goto IIS and set the default page
  10. In the Amazon EC2 console, stop the EC2 instance and then choose Create Image (EBS AMI) from the Instance Actions menu.
  11. To avoid incurring additional AWS charges, terminate the EC2 instance.
III.  Create Elastic Beanstalk Environment using custom AMI
  1. Create a IIS/Windows Environment following AWS Document.
    Please follow only steps under "Create the Environment".
  2. Go to Configuration - > Instances - > Custom AMI ID - > Enter the  EBS AMI created in the step II and Click "Save".
    [Screen]
  3. Launch your application and verify.
Congratulations! You now have a working Classic ASP application running on AWS Elastic Beanstalk.

18 comments:

  1. I'm under the impression that Elastic Beanstalk means I don't manage OS Patching for the web servers. If I create a custom AMI as you describe, doesn't that mean I'm now responsible for security and bug patches?

    ReplyDelete
    Replies
    1. Elastic beanstalk servers updates depends on the its "Managed Platform Updates" settings. So it it should work for custom AMI also.
      https://aws.amazon.com/about-aws/whats-new/2016/04/aws-elastic-beanstalk-introduces-managed-platform-updates/
      http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environment-platform-update-managed.html

      Delete
  2. If I am going to be deploying my application using awsdeploy.exe, what should my packaged classic asp code look like? Should it just be a zip of the asp code that will be unzipped into the inetpub folder? Is there an additional step I need to do to make sure it gets put in the right place when I deploy it?

    Thanks for any help you can offer. :) I'm just doing a bit of research before I start putting the last part of this together.

    ReplyDelete
  3. Sorry for delay, I used Visual studio with aws pug-in. You can follow same steps as asp.net application.
    http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_NET.quickstart.html

    ReplyDelete
  4. It was really a nice post and I was really impressed by reading this .NET Online Course

    ReplyDelete
  5. there is no Continous deployment Pipeline. No updates can be made to the code with this approach.

    ReplyDelete