0

Can someone tell any way to deploy different web.config on different EC2 instances with in same deployment group.

Scenario: We have few entries in the config that will be different on different instances. So need some way to update based on instance.

4
  • You can make it as part of your build process if your are building for each instance. You would use xml transforms to change the web.config per configuration. Or you can make it part of your deployment script and just swap the values prior to starting the service. Commented Apr 18, 2018 at 2:47
  • Hey Terry! I am a bit new on AWS. You have some way how we can associate variable with specific AWS instance. We have one build only and we want to change variable value on each instance it is deployed. Commented Apr 23, 2018 at 19:06
  • Are you using a script to deploy? Commented Apr 24, 2018 at 2:38
  • We are using power shell script to call New-CDDeployment from AWSPowerShell module. Commented Apr 26, 2018 at 10:41

2 Answers 2

1

Create a script to make the necessary changes to your web.config and then use the hooks section of your app.spec file to run the script before install on your deployment. https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html

Sign up to request clarification or add additional context in comments.

Comments

1

I actually took the approach of storing my web.config files for each environment in an S3 bucket. As part of the CodeDeploy Deployment group process, it would download the config file from the S3 bucket in the After Install hook. This way you can build the application once and push the same application files for each environment. This also separates the configuration of the application from the actual code so that the development team doesn't need to know things like connection string values, etc...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.