designs/debug_mode_multiple_exposed_ports.md
Currently, there is one port is exposed from Docker instance when running lambda in debug mode. This port is used to connect a debugger. In my case, I need two ports to be exposed due to Debugger implementation specific (the Debugger connect to two sockets to collect different information).
SAM CLI has a --debug-port parameter that provide a port. This parameter is stored in DebugContext object.
DebugContext should store an array of ports instead of a single port. This array should be transformed
into a map containing each stored port when passing to docker container arguments.
All ports specified via single or multiple --debug-port SAM CLI options should be exposed by docker container.
From the user perspective, it should only provide an ability to specify multiple --debug-port options:
--debug-port 5600 --debug-port 5601
SAM CLI provide an option to specify multiple ports --debug-port 5600 --debug-port 5601.
No changes.
Update --debug-port option to allow to use it multiple times in SAM CLI.
The option type should take only integer values. The value is stored in DebugContext.
This value should be converted into a map of { container_port : host_port }
that is passed to ports argument when creating a docker container.
.samrc ChangesNo changes.
No changes.
What new dependencies (libraries/cli) does this change require?
What other Docker container images are you using?
Are you creating a new HTTP endpoint? If so explain how it will be created & used
Are you connecting to a remote API? If so explain how is this connection secured
Are you reading/writing to a temporary folder? If so, what is this used for and when do you clean up?
How do you validate new .samrc configuration?
Make sure SAM CLI users can specify multiple ports and those ports are exposed after creating a docker container in debug mode:
sam local invoke --template <path_to_template>/template.yaml --event <path_to_event>/event.json --debugger-path <path_to_debugger> --debug-port 5600 --debug-port 5601
Running SAM CLI with debug mode.
--debug-port 5600--debug-port 5600 --debug-port 5601--debug-port --debug-port parameter is specified