Question: My app currently uses a folder called "Documents" that is located in the root of the app. This is where it stores supporting docs, temporary files, uploaded files etc. I'm trying to move my app from Azure to Beanstalk and I don't know how to give permissions to this folder and sub-folders. I think it's supposed to be done using .ebextensions but I don't know how to format the config file. Can someone suggest how this config file should look? This is an ASP.NET app running on Windows/IIS.

Answer: 
Unfortunately, you cannot use .ebextensions to set permissions to files/folders within your deployment directory.

If you look at the event hooks for an elastic beanstalk deployment:
<https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-windows-ec2.html#windows-container-commands>

You'll find that `commands` run **before** the ec2 app and web server are set up, and
`container_commands` run **after** the ec2 app and web server are setup, but **before** your application version is deployed.

The solution is to use a **wpp.targets** file to set the necessary ACLs.
The following SO post is most useful
[Can Web Deploy's setAcl provider be used on a sub-directory?](https://stackoverflow.com/questions/6861990/can-web-deploys-setacl-provider-be-used-on-a-sub-directory)
Given below is the sample .ebextensions config file to create a directory/file and modify the permissions and add some content to the file

====== .ebextensions/custom\_directory.config ======

```
commands:
  create_directory:
    command: mkdir C:\inetpub\AspNetCoreWebApps\backgroundtasks\mydirectory
    command: cacls C:\inetpub\AspNetCoreWebApps\backgroundtasks\mydirectory /t /e /g username:W
files:
 "C:/inetpub/AspNetCoreWebApps/backgroundtasks/mydirectory/mytestfile.txt":
   content: |
     This is my Sample file created from ebextensions

```

ebextensions go into the root of the application source code through a directory called .ebextensions. For more information on how to use ebextensions, please go through the documentation [here](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-windows-ec2.html)