So I had a .Net application that needed to leverage the Network Service application identity instead of the OOB ApplicationPoolIdentity that comes with a default shipped EBS windows server with IIS. The solution? An ebextenion of course!
0) We’re going to have a step 0 assuming you already have a development AWS account with credits to push servers to Elastic Beanstalk. If you have not do this part then do some reading here: https://aws.amazon.com/elasticbeanstalk/
1) Once you have an account and have configured your Visual Studio environment to your account appropriately then proceed to open your VS solution.
2) Create a folder in your solution called .ebextensions
3) Create your config file (if you don’t have an editor Notepad++ will do) within that folder and edit it in YAML format
The following example below will update the DefaultAppPool app identity to Network Service leveraging powershell and the commands/command features:
files: "C:\\Robo\\Update_App_Pool.ps1": content: | Write-Verbose 'Update the application pool' Set-Location C:\\Robo import-module WebAdministration Set-ItemProperty IIS:\AppPools\DefaultAppPool -name processModel.identityType -value 2 commands: update_app_pool: command: powershell.exe -ExecutionPolicy Bypass -File "C:\\Robo\\Update_App_Pool.ps1" ignoreErrors: False waitAfterCompletion: 0
4) Save the Deploy this with your application into EBS you should see the updated app pool identity as the application is deployed.
Hope this helps. Questions are welcome!
If you want to venture deeper into this then start here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html
Validate here: http://www.yamllint.com/