there, I have already an environment variable setup in ECS task definition as shown in the screenshot. And I was supposing that I could simply treat it as an regular env and read it like this in Spring:
@Value("${activeDirectoryPwd}")
private String adPwd;
but somehow the variable adPwd comes back null. Do I have to read it differently?
Environmental variables are environmental variables no matter how they are defined, so there is likely something going on within your containers themselves. Is your Spring application being launched directly in the container or is there another service running it?
As a separate note, you shouldn't pass passwords directly into the task definition like that. Instead you should store it in the Secrets Manager or the Parameter Store and pass the secret through in the task definition. This prevents the secret from being read in the AWS Console.