Question

I am trying to migrate a production web server to AWS, the server is windows based IIS with multiple applications defined under 1 website. I have tried both Elastic Beanstalk and Cloud formation. I would prefer to elastic beanstalk, but I would be happy with anything that has auto scaling and a easy deployment routine.

I have created a sample website with one child application, it works fine locally. I tried to edit the default AMI for elastic beanstalk to add the extra application and deploy to it. When I tried to redeploy the application with the new AMI, it failed finish the deployment it failed with the following error.

[Instance: i-3f13bc11 Module: AWSEBAutoScalingGroup ConfigSet: Infra-WriteRuntimeConfig, Infra-WriteApplication1, Infra-WriteApplication2, Infra-EmbeddedPreBuild, Hook-PreAppDeploy, Hook-EnactAppDeploy, Infra-EmbeddedPostBuild, Hook-PostAppDeploy] Command failed on instance. Return code: 1 Output: null.

I did try to use the cloud-formation template that comes with the visual studio, it did not work either, it failed with a very similar error message.

Was it helpful?

Solution

The best way to do this is to use CloudFormation to create an auto scale group. In the LaunchConfiguration type you can add your files from S3 and instruct IIS to install the apps. For example:

"WebAsSpotLaunchConfiguration" : {
            "Type" : "AWS::AutoScaling::LaunchConfiguration",
            "Metadata" : {
                "AWS::CloudFormation::Init" : {
                    "config" : {
                        "sources" : {
                            "C:\\inetpub\\wwwroot" : {
                                "Fn::Join" : [
                                    "/",
                                    [
                                        "http://s3.amazonaws.com",
                                        {
                                            "Ref" : "DeployS3Bucket"
                                        },
                                        {
                                            "Ref" : "DeployWebS3Key"
                                        }
                                    ]
                                ]
                            }
                        },
                        "commands" : {
                            "1-add-app-1" : {
                                "command" : "C:\\Windows\\System32\\inetsrv\\appcmd add app /site.name:MySite /path:/app1 /physicalPath:C:\inetpub\mysite\app1",
                                "waitAfterCompletion" : "0"
                            },
                            "2-add-app-2"     : {
                                "command" : "C:\\Windows\\System32\\inetsrv\\appcmd add app /site.name:MySite /path:/app2 /physicalPath:C:\inetpub\mysite\app2",
                                "waitAfterCompletion" : "0"
                            }
                        }
                    }
                },

I realize that if you don't already know CloudFormation, this may take some time to setup. But it's worth the investment in my opinion.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top