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.