This question already has an answer here:
I wish to run a docker in a EC2 instance with AWS API, and I have a Dockerrun.aws.json like this:
{
"AWSEBDockerrunVersion": "1",
"Authentication": {
"Bucket": "<BUCKET>",
"Key": ".dockercfg"
},
"Image": {
"Name": "<NAME>:<TAG>",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "80"
},
{
"ContainerPort": "443"
}
]
}
Like you can see, I have multiple ports to expose, but elastic beanstalk expose only the first of they.
I found this sentence in the documentation: You can specify multiple container ports, but AWS Elastic Beanstalk uses only the first one to connect your container to the host's reverse proxy and route requests from the public Internet.
My question is why ?
I have an authentication which use Oauth2 protocol, and I must use HTTPS protocol for obvious security reasons. With this restriction, I can only choose HTTP or HTTPS, because I can only expose port 80 or 443.
I tried to tinker ebextensions to make nginx redirections with ports at the level of EC2 instances, but i've failed. How can I do ?
This stackoverflow user has the same problem. Exposing multiple ports from Docker within Elastic Beanstalk
Thanking you in advance
I contacted the Amazon Support Center, and I chose to show you the answer.
*
And he gave me an example in attachment. 01-nginx-ssl.config