Repository: aws/aws-sam-cli

Issue:
Bug: `sam local start-api --add-host` does not work
<!-- Make sure we don't have an existing Issue that reports the bug you are seeing (both open and closed). 
If you do find an existing Issue, re-open or add a comment to that Issue instead of creating a new one. -->

### Description:
<!-- Briefly describe the bug you are facing.-->
I executed `sam local start-api --add-host="host.docker.internal:host-gateway"`, but it didn't reflect in the hosts file.

### Steps to reproduce:
<!-- Provide detailed steps to replicate the bug, including steps from third party tools (CDK, etc.) -->

Execute `sam local start-api --add-host="xxx"` command.


### Observed result:
<!-- Please provide command output with `--debug` flag set. -->



### Expected result:
<!-- Describe what you expected. -->



### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

<!-- Either provide the following info (for AWS SAM CLI v1.68.0 or before) or paste the output of `sam --info` (AWS SAM CLI v1.69.0 or after). -->

1. OS: Ubuntu 22.04.3 LTS (5.15.146.1-microsoft-standard-WSL2)
2. `sam --version`:  SAM CLI, version 1.113.0
3. AWS region:

```
# Paste the output of `sam --info` here
$ sam --info
{
  "version": "1.113.0",
  "system": {
    "python": "3.11.3",
    "os": "Linux-5.15.146.1-microsoft-standard-WSL2-x86_64-with-glibc2.35"
  },
  "additional_dependencies": {
    "docker_engine": "24.0.7",
    "aws_cdk": "Not available",
    "terraform": "1.6.5"
  },
  "available_beta_feature_env_vars": [
    "SAM_CLI_BETA_FEATURES",
    "SAM_CLI_BETA_BUILD_PERFORMANCE",
    "SAM_CLI_BETA_TERRAFORM_SUPPORT",
    "SAM_CLI_BETA_RUST_CARGO_LAMBDA"
  ]
}
```

`Add --debug flag to command you are running`


Discussion:
lucashuy: Thanks for making creating this fix! The changes look good to me, can you run a quick `make format` to fix any formatting issues in the source code? Looks like that is what is causing the PR jobs to fail at the moment.
gkuga: @lucashuy Thanks for your feedback. I've run `make format`. Will the workflow pass?

Patch:
diff --git a/installer/pyinstaller/build-linux.sh b/installer/pyinstaller/build-linux.sh
index c096508a..a52c9ed7 100755
--- a/installer/pyinstaller/build-linux.sh
+++ b/installer/pyinstaller/build-linux.sh
@@ -10,7 +10,7 @@ if [ "$python_library_zip_filename" = "" ]; then
 fi
 
 if [ "$python_version" = "" ]; then
-    python_version="3.11.3";
+    python_version="3.11.8";
 fi
 
 if [ "$CI_OVERRIDE" = "1" ]; then
@@ -28,7 +28,7 @@ fi
 
 set -eux
 
-yum install -y zlib-devel libffi-devel bzip2-devel
+yum install -y libffi-devel bzip2-devel
 
 echo "Making Folders"
 mkdir -p .build/src
@@ -38,17 +38,25 @@ mkdir -p .build/output/pyinstaller-output
 mkdir -p .build/output/openssl
 cd .build/output/openssl
 
+echo "Building OpenSSL"
 curl "https://www.openssl.org/source/openssl-1.1.1w.tar.gz" --output openssl-1.1.1.tar.gz
 tar xzf openssl-1.1.1.tar.gz
 cd openssl-1.1.1w
-./config --prefix=/opt/openssl && make && make install
+./config --prefix=/opt/openssl && make -j8 && make install
 cd ../../..
 
+echo "Building zlib"
+curl https://www.zlib.net/zlib-1.3.1.tar.gz --output zlib.tar.gz
+tar xvf zlib.tar.gz
+cd zlib-1.3.1
+./configure && make -j8 && make install
+cd ../
+
 echo "Copying Source"
 cp -r ../[!.]* ./src
 cp -r ./src/* ./output/aws-sam-cli-src
 
-echo "Removing CI Scripts and other files/direcories not needed"
+echo "Removing CI Scripts and other files/directories not needed"
 rm -vf ./output/aws-sam-cli-src/appveyor*.yml
 rm -rf ./output/aws-sam-cli-src/tests
 rm -rf ./output/aws-sam-cli-src/designs
@@ -68,7 +76,10 @@ echo "Installing Python"
 curl "https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz" --output python.tgz
 tar -xzf python.tgz
 cd Python-$python_version
-./configure --enable-shared --with-openssl=/opt/openssl --with-openssl-rpath=auto 
+./configure \
+    --enable-shared \
+    --with-openssl=/opt/openssl \
+    --with-openssl-rpath=auto
 make -j8
 make install
 ldconfig
diff --git a/requirements/base.txt b/requirements/base.txt
index 46a7d0d1..e118711a 100644
--- a/requirements/base.txt
+++ b/requirements/base.txt
@@ -6,7 +6,7 @@ jmespath~=1.0.1
 ruamel_yaml~=0.18.6
 PyYAML~=6.0,>=6.0.1
 cookiecutter~=2.6.0
-aws-sam-translator==1.86.0
+aws-sam-translator==1.87.0
 #docker minor version updates can include breaking changes. Auto update micro version only.
 docker~=7.0.0
 dateparser~=1.2
@@ -31,4 +31,4 @@ tzlocal==5.2
 cfn-lint~=0.86.1
 
 # Type checking boto3 objects
-boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.74
+boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.78
diff --git a/requirements/pre-dev.txt b/requirements/pre-dev.txt
index e43c0da3..7bb50cf5 100644
--- a/requirements/pre-dev.txt
+++ b/requirements/pre-dev.txt
@@ -1,1 +1,1 @@
-ruff==0.3.4
+ruff==0.3.5
diff --git a/requirements/reproducible-linux.txt b/requirements/reproducible-linux.txt
index 01ff9404..aab7dd19 100644
--- a/requirements/reproducible-linux.txt
+++ b/requirements/reproducible-linux.txt
@@ -24,9 +24,9 @@ aws-lambda-builders==1.48.0 \
     --hash=sha256:01a2f41a49c118066a05428a924f08b65112565b155e43beb980517a6d295ae4 \
     --hash=sha256:683155f44f373aa72eba0ea74dd324d688881de65984e9ca391ca1ec10aee6ed
     # via aws-sam-cli (setup.py)
-aws-sam-translator==1.86.0 \
-    --hash=sha256:97a44e5ac8b0d141c31f4ed35c57aa94429a0e6cef7fe989831c9a1c40455473 \
-    --hash=sha256:a748dcd7886024cb7586abbbdbabe8c787c44c6547bb6602879d7bb8a6934d05
+aws-sam-translator==1.87.0 \
+    --hash=sha256:40cef8980d656107406dafe30aef34b67be33929d2b9492e93f8e9ce07ece1c1 \
+    --hash=sha256:80f4fb6d53774634b6ea84af5fdfa9ad94a46945bc4ad4ef11c8008540dfa7f8
     # via
     #   aws-sam-cli (setup.py)
     #   cfn-lint
@@ -38,19 +38,19 @@ blinker==1.7.0 \
     --hash=sha256:c3f865d4d54db7abc53758a01601cf343fe55b84c1de4e3fa910e420b438d5b9 \
     --hash=sha256:e6820ff6fa4e4d1d8e2747c2283749c3f547e4fee112b98555cdcdae32996182
     # via flask
-boto3==1.34.74 \
-    --hash=sha256:71f551491fb12fe07727d371d5561c5919fdf33dbc1d4251c57940d267a53a9e \
-    --hash=sha256:b703e22775561a748adc4576c30424b81abd2a00d3c6fb28eec2e5cde92c1eed
+boto3==1.34.78 \
+    --hash=sha256:227487f9a40e7963aa108f4fabc81374d65e085891a2a442c190dfd976b86a9e \
+    --hash=sha256:47a7899af97960493ed58754c838be658650c8fb231c658866f491965ddfc94f
     # via
     #   aws-sam-cli (setup.py)
     #   aws-sam-translator
-boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.34.74 \
-    --hash=sha256:2efb27b39a80f41b4f73f924dd5296b64711ac9a5f5534c2bf0e1250e645261d \
-    --hash=sha256:4b9ed86ba5ca8d82fec21fcd1c4900be9d4719ebc4b6c3d95c0e7707984b96da
+boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.34.78 \
+    --hash=sha256:6e35befd50a1d5d8292f55589c70c5bc6cce8e75310a85f9149311271a9d914f \
+    --hash=sha256:9668c6efa6e52ca4fbda7fee2dff9b2e21cc5a1645085951d78189e561a1e6ef
     # via aws-sam-cli (setup.py)
-botocore==1.34.74 \
-    --hash=sha256:32bb519bae62483893330c18a0ea4fd09d1ffa32bc573cd8559c2d9a08fb8c5c \
-    --hash=sha256:5d2015b5d91d6c402c122783729ce995ed7283a746b0380957026dc2b3b75969
+botocore==1.34.78 \
+    --hash=sha256:889fcfd1813fad225a5a70940c58cd4bd7a6f5ba6c9769a1d41d0c670272b75d \
+    --hash=sha256:bc10738826a4970a6d3a40ac40b9799c02b1b661c0c741a67b915b500562ab3c
     # via
     #   boto3
     #   s3transfer
@@ -409,9 +409,9 @@ mypy-boto3-apigateway==1.34.56 \
     --hash=sha256:3695503bd9388b3067c1dc1dc4ec1486dcec450dbf1e9889f451120e333b92da \
     --hash=sha256:5ab15db30d730198384d6445d50cc1fec98361b85366dd092b10e9b9f4a1a2cb
     # via boto3-stubs
-mypy-boto3-cloudformation==1.34.66 \
-    --hash=sha256:295ddb878f3f4b61489b83bd4bad949382deb8a478ff5ae66c22ca3ffbabbe95 \
-    --hash=sha256:e0080e4ba0cd464479f3ee285faddd863e40147e8f331b78445aef210afc91ed
+mypy-boto3-cloudformation==1.34.77 \
+    --hash=sha256:4a32a2f7e1e06a1ed4daa1e278149b1a70876b108f0056507f7d7483856a93a6 \
+    --hash=sha256:990014182681f9df2257f185056126c0db30bf1260f6cd3d46cedb3cf467f0ad
     # via boto3-stubs
 mypy-boto3-ecr==1.34.0 \
     --hash=sha256:3346c02c22b16068c9acc67d990e32060bf7cdaea5f3d43c50e44308fbbc3439 \
@@ -425,9 +425,9 @@ mypy-boto3-kinesis==1.34.0 \
     --hash=sha256:1add81c53f6e36599e0c22e142024867759aaf2f4954bcb2baa21c284c852377 \
     --hash=sha256:f404e75badd5977e9f09741b769b8888854bdd411c631344686ab889efe98741
     # via boto3-stubs
-mypy-boto3-lambda==1.34.58 \
-    --hash=sha256:6ab1b9611ff396e9310ad77f02994a6e03d40c8a0eea51085e355b4fd2a0cbc9 \
-    --hash=sha256:903822c74bd1b34748eb2d72eab0f132fbc3b392c8041aa8fe4d9552a44b0c65
+mypy-boto3-lambda==1.34.77 \
+    --hash=sha256:7b81d2a5604fb592e92fe0b284ecd259de071703360a33b71c9b54df46d81c9c \
+    --hash=sha256:e21022d2eef12aa731af80790410afdba9412b056339823252813bae2adbf553
     # via boto3-stubs
 mypy-boto3-s3==1.34.65 \
     --hash=sha256:2aecfbe1c00654bc21f839068218d60123366954bf43a708baa50f9543e3f205 \
@@ -1013,9 +1013,9 @@ watchdog==4.0.0 \
     --hash=sha256:f970663fa4f7e80401a7b0cbeec00fa801bf0287d93d48368fc3e6fa32716245 \
     --hash=sha256:f9b2fdca47dc855516b2d66eef3c39f2672cbf7e7a42e7e67ad2cbfcd6ba107d
     # via aws-sam-cli (setup.py)
-werkzeug==3.0.1 \
-    --hash=sha256:507e811ecea72b18a404947aded4b3390e1db8f826b494d76550ef45bb3b1dcc \
-    --hash=sha256:90a285dc0e42ad56b34e696398b8122ee4c681833fb35b8334a095d82c56da10
+werkzeug==3.0.2 \
+    --hash=sha256:3aac3f5da756f93030740bc235d3e09449efcf65f2f55e3602e1d851b8f48795 \
+    --hash=sha256:e39b645a6ac92822588e7b39a692e7828724ceae0b0d702ef96701f90e70128d
     # via flask
 wheel==0.43.0 \
     --hash=sha256:465ef92c69fa5c5da2d1cf8ac40559a8c940886afcef87dcf14b9470862f1d85 \
diff --git a/requirements/reproducible-mac.txt b/requirements/reproducible-mac.txt
index d5682d39..6a6d3e73 100644
--- a/requirements/reproducible-mac.txt
+++ b/requirements/reproducible-mac.txt
@@ -24,9 +24,9 @@ aws-lambda-builders==1.48.0 \
     --hash=sha256:01a2f41a49c118066a05428a924f08b65112565b155e43beb980517a6d295ae4 \
     --hash=sha256:683155f44f373aa72eba0ea74dd324d688881de65984e9ca391ca1ec10aee6ed
     # via aws-sam-cli (setup.py)
-aws-sam-translator==1.86.0 \
-    --hash=sha256:97a44e5ac8b0d141c31f4ed35c57aa94429a0e6cef7fe989831c9a1c40455473 \
-    --hash=sha256:a748dcd7886024cb7586abbbdbabe8c787c44c6547bb6602879d7bb8a6934d05
+aws-sam-translator==1.87.0 \
+    --hash=sha256:40cef8980d656107406dafe30aef34b67be33929d2b9492e93f8e9ce07ece1c1 \
+    --hash=sha256:80f4fb6d53774634b6ea84af5fdfa9ad94a46945bc4ad4ef11c8008540dfa7f8
     # via
     #   aws-sam-cli (setup.py)
     #   cfn-lint
@@ -56,19 +56,19 @@ blinker==1.7.0 \
     --hash=sha256:c3f865d4d54db7abc53758a01601cf343fe55b84c1de4e3fa910e420b438d5b9 \
     --hash=sha256:e6820ff6fa4e4d1d8e2747c2283749c3f547e4fee112b98555cdcdae32996182
     # via flask
-boto3==1.34.74 \
-    --hash=sha256:71f551491fb12fe07727d371d5561c5919fdf33dbc1d4251c57940d267a53a9e \
-    --hash=sha256:b703e22775561a748adc4576c30424b81abd2a00d3c6fb28eec2e5cde92c1eed
+boto3==1.34.78 \
+    --hash=sha256:227487f9a40e7963aa108f4fabc81374d65e085891a2a442c190dfd976b86a9e \
+    --hash=sha256:47a7899af97960493ed58754c838be658650c8fb231c658866f491965ddfc94f
     # via
     #   aws-sam-cli (setup.py)
     #   aws-sam-translator
-boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.34.74 \
-    --hash=sha256:2efb27b39a80f41b4f73f924dd5296b64711ac9a5f5534c2bf0e1250e645261d \
-    --hash=sha256:4b9ed86ba5ca8d82fec21fcd1c4900be9d4719ebc4b6c3d95c0e7707984b96da
+boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.34.78 \
+    --hash=sha256:6e35befd50a1d5d8292f55589c70c5bc6cce8e75310a85f9149311271a9d914f \
+    --hash=sha256:9668c6efa6e52ca4fbda7fee2dff9b2e21cc5a1645085951d78189e561a1e6ef
     # via aws-sam-cli (setup.py)
-botocore==1.34.74 \
-    --hash=sha256:32bb519bae62483893330c18a0ea4fd09d1ffa32bc573cd8559c2d9a08fb8c5c \
-    --hash=sha256:5d2015b5d91d6c402c122783729ce995ed7283a746b0380957026dc2b3b75969
+botocore==1.34.78 \
+    --hash=sha256:889fcfd1813fad225a5a70940c58cd4bd7a6f5ba6c9769a1d41d0c670272b75d \
+    --hash=sha256:bc10738826a4970a6d3a40ac40b9799c02b1b661c0c741a67b915b500562ab3c
     # via
     #   boto3
     #   s3transfer
@@ -437,9 +437,9 @@ mypy-boto3-apigateway==1.34.56 \
     --hash=sha256:3695503bd9388b3067c1dc1dc4ec1486dcec450dbf1e9889f451120e333b92da \
     --hash=sha256:5ab15db30d730198384d6445d50cc1fec98361b85366dd092b10e9b9f4a1a2cb
     # via boto3-stubs
-mypy-boto3-cloudformation==1.34.66 \
-    --hash=sha256:295ddb878f3f4b61489b83bd4bad949382deb8a478ff5ae66c22ca3ffbabbe95 \
-    --hash=sha256:e0080e4ba0cd464479f3ee285faddd863e40147e8f331b78445aef210afc91ed
+mypy-boto3-cloudformation==1.34.77 \
+    --hash=sha256:4a32a2f7e1e06a1ed4daa1e278149b1a70876b108f0056507f7d7483856a93a6 \
+    --hash=sha256:990014182681f9df2257f185056126c0db30bf1260f6cd3d46cedb3cf467f0ad
     # via boto3-stubs
 mypy-boto3-ecr==1.34.0 \
     --hash=sha256:3346c02c22b16068c9acc67d990e32060bf7cdaea5f3d43c50e44308fbbc3439 \
@@ -453,9 +453,9 @@ mypy-boto3-kinesis==1.34.0 \
     --hash=sha256:1add81c53f6e36599e0c22e142024867759aaf2f4954bcb2baa21c284c852377 \
     --hash=sha256:f404e75badd5977e9f09741b769b8888854bdd411c631344686ab889efe98741
     # via boto3-stubs
-mypy-boto3-lambda==1.34.58 \
-    --hash=sha256:6ab1b9611ff396e9310ad77f02994a6e03d40c8a0eea51085e355b4fd2a0cbc9 \
-    --hash=sha256:903822c74bd1b34748eb2d72eab0f132fbc3b392c8041aa8fe4d9552a44b0c65
+mypy-boto3-lambda==1.34.77 \
+    --hash=sha256:7b81d2a5604fb592e92fe0b284ecd259de071703360a33b71c9b54df46d81c9c \
+    --hash=sha256:e21022d2eef12aa731af80790410afdba9412b056339823252813bae2adbf553
     # via boto3-stubs
 mypy-boto3-s3==1.34.65 \
     --hash=sha256:2aecfbe1c00654bc21f839068218d60123366954bf43a708baa50f9543e3f205 \
@@ -1048,9 +1048,9 @@ watchdog==4.0.0 \
     --hash=sha256:f970663fa4f7e80401a7b0cbeec00fa801bf0287d93d48368fc3e6fa32716245 \
     --hash=sha256:f9b2fdca47dc855516b2d66eef3c39f2672cbf7e7a42e7e67ad2cbfcd6ba107d
     # via aws-sam-cli (setup.py)
-werkzeug==3.0.1 \
-    --hash=sha256:507e811ecea72b18a404947aded4b3390e1db8f826b494d76550ef45bb3b1dcc \
-    --hash=sha256:90a285dc0e42ad56b34e696398b8122ee4c681833fb35b8334a095d82c56da10
+werkzeug==3.0.2 \
+    --hash=sha256:3aac3f5da756f93030740bc235d3e09449efcf65f2f55e3602e1d851b8f48795 \
+    --hash=sha256:e39b645a6ac92822588e7b39a692e7828724ceae0b0d702ef96701f90e70128d
     # via flask
 wheel==0.43.0 \
     --hash=sha256:465ef92c69fa5c5da2d1cf8ac40559a8c940886afcef87dcf14b9470862f1d85 \
diff --git a/requirements/reproducible-win.txt b/requirements/reproducible-win.txt
index 079ea560..530603e2 100644
--- a/requirements/reproducible-win.txt
+++ b/requirements/reproducible-win.txt
@@ -24,9 +24,9 @@ aws-lambda-builders==1.48.0 \
     --hash=sha256:01a2f41a49c118066a05428a924f08b65112565b155e43beb980517a6d295ae4 \
     --hash=sha256:683155f44f373aa72eba0ea74dd324d688881de65984e9ca391ca1ec10aee6ed
     # via aws-sam-cli (setup.py)
-aws-sam-translator==1.86.0 \
-    --hash=sha256:97a44e5ac8b0d141c31f4ed35c57aa94429a0e6cef7fe989831c9a1c40455473 \
-    --hash=sha256:a748dcd7886024cb7586abbbdbabe8c787c44c6547bb6602879d7bb8a6934d05
+aws-sam-translator==1.87.0 \
+    --hash=sha256:40cef8980d656107406dafe30aef34b67be33929d2b9492e93f8e9ce07ece1c1 \
+    --hash=sha256:80f4fb6d53774634b6ea84af5fdfa9ad94a46945bc4ad4ef11c8008540dfa7f8
     # via
     #   aws-sam-cli (setup.py)
     #   cfn-lint
@@ -38,19 +38,19 @@ blinker==1.7.0 \
     --hash=sha256:c3f865d4d54db7abc53758a01601cf343fe55b84c1de4e3fa910e420b438d5b9 \
     --hash=sha256:e6820ff6fa4e4d1d8e2747c2283749c3f547e4fee112b98555cdcdae32996182
     # via flask
-boto3==1.34.74 \
-    --hash=sha256:71f551491fb12fe07727d371d5561c5919fdf33dbc1d4251c57940d267a53a9e \
-    --hash=sha256:b703e22775561a748adc4576c30424b81abd2a00d3c6fb28eec2e5cde92c1eed
+boto3==1.34.78 \
+    --hash=sha256:227487f9a40e7963aa108f4fabc81374d65e085891a2a442c190dfd976b86a9e \
+    --hash=sha256:47a7899af97960493ed58754c838be658650c8fb231c658866f491965ddfc94f
     # via
     #   aws-sam-cli (setup.py)
     #   aws-sam-translator
-boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.34.74 \
-    --hash=sha256:2efb27b39a80f41b4f73f924dd5296b64711ac9a5f5534c2bf0e1250e645261d \
-    --hash=sha256:4b9ed86ba5ca8d82fec21fcd1c4900be9d4719ebc4b6c3d95c0e7707984b96da
+boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.34.78 \
+    --hash=sha256:6e35befd50a1d5d8292f55589c70c5bc6cce8e75310a85f9149311271a9d914f \
+    --hash=sha256:9668c6efa6e52ca4fbda7fee2dff9b2e21cc5a1645085951d78189e561a1e6ef
     # via aws-sam-cli (setup.py)
-botocore==1.34.74 \
-    --hash=sha256:32bb519bae62483893330c18a0ea4fd09d1ffa32bc573cd8559c2d9a08fb8c5c \
-    --hash=sha256:5d2015b5d91d6c402c122783729ce995ed7283a746b0380957026dc2b3b75969
+botocore==1.34.78 \
+    --hash=sha256:889fcfd1813fad225a5a70940c58cd4bd7a6f5ba6c9769a1d41d0c670272b75d \
+    --hash=sha256:bc10738826a4970a6d3a40ac40b9799c02b1b661c0c741a67b915b500562ab3c
     # via
     #   boto3
     #   s3transfer
@@ -413,9 +413,9 @@ mypy-boto3-apigateway==1.34.56 \
     --hash=sha256:3695503bd9388b3067c1dc1dc4ec1486dcec450dbf1e9889f451120e333b92da \
     --hash=sha256:5ab15db30d730198384d6445d50cc1fec98361b85366dd092b10e9b9f4a1a2cb
     # via boto3-stubs
-mypy-boto3-cloudformation==1.34.66 \
-    --hash=sha256:295ddb878f3f4b61489b83bd4bad949382deb8a478ff5ae66c22ca3ffbabbe95 \
-    --hash=sha256:e0080e4ba0cd464479f3ee285faddd863e40147e8f331b78445aef210afc91ed
+mypy-boto3-cloudformation==1.34.77 \
+    --hash=sha256:4a32a2f7e1e06a1ed4daa1e278149b1a70876b108f0056507f7d7483856a93a6 \
+    --hash=sha256:990014182681f9df2257f185056126c0db30bf1260f6cd3d46cedb3cf467f0ad
     # via boto3-stubs
 mypy-boto3-ecr==1.34.0 \
     --hash=sha256:3346c02c22b16068c9acc67d990e32060bf7cdaea5f3d43c50e44308fbbc3439 \
@@ -429,9 +429,9 @@ mypy-boto3-kinesis==1.34.0 \
     --hash=sha256:1add81c53f6e36599e0c22e142024867759aaf2f4954bcb2baa21c284c852377 \
     --hash=sha256:f404e75badd5977e9f09741b769b8888854bdd411c631344686ab889efe98741
     # via boto3-stubs
-mypy-boto3-lambda==1.34.58 \
-    --hash=sha256:6ab1b9611ff396e9310ad77f02994a6e03d40c8a0eea51085e355b4fd2a0cbc9 \
-    --hash=sha256:903822c74bd1b34748eb2d72eab0f132fbc3b392c8041aa8fe4d9552a44b0c65
+mypy-boto3-lambda==1.34.77 \
+    --hash=sha256:7b81d2a5604fb592e92fe0b284ecd259de071703360a33b71c9b54df46d81c9c \
+    --hash=sha256:e21022d2eef12aa731af80790410afdba9412b056339823252813bae2adbf553
     # via boto3-stubs
 mypy-boto3-s3==1.34.65 \
     --hash=sha256:2aecfbe1c00654bc21f839068218d60123366954bf43a708baa50f9543e3f205 \
@@ -1037,9 +1037,9 @@ watchdog==4.0.0 \
     --hash=sha256:f970663fa4f7e80401a7b0cbeec00fa801bf0287d93d48368fc3e6fa32716245 \
     --hash=sha256:f9b2fdca47dc855516b2d66eef3c39f2672cbf7e7a42e7e67ad2cbfcd6ba107d
     # via aws-sam-cli (setup.py)
-werkzeug==3.0.1 \
-    --hash=sha256:507e811ecea72b18a404947aded4b3390e1db8f826b494d76550ef45bb3b1dcc \
-    --hash=sha256:90a285dc0e42ad56b34e696398b8122ee4c681833fb35b8334a095d82c56da10
+werkzeug==3.0.2 \
+    --hash=sha256:3aac3f5da756f93030740bc235d3e09449efcf65f2f55e3602e1d851b8f48795 \
+    --hash=sha256:e39b645a6ac92822588e7b39a692e7828724ceae0b0d702ef96701f90e70128d
     # via flask
 wheel==0.43.0 \
     --hash=sha256:465ef92c69fa5c5da2d1cf8ac40559a8c940886afcef87dcf14b9470862f1d85 \
diff --git a/samcli/commands/local/cli_common/invoke_context.py b/samcli/commands/local/cli_common/invoke_context.py
index 20b30f67..10e9fdb3 100644
--- a/samcli/commands/local/cli_common/invoke_context.py
+++ b/samcli/commands/local/cli_common/invoke_context.py
@@ -311,7 +311,12 @@ class InvokeContext:
         def initialize_function_container(function: Function) -> None:
             function_config = self.local_lambda_runner.get_invoke_config(function)
             self.lambda_runtime.run(
-                None, function_config, self._debug_context, self._container_host, self._container_host_interface
+                container=None,
+                function_config=function_config,
+                debug_context=self._debug_context,
+                container_host=self._container_host,
+                container_host_interface=self._container_host_interface,
+                extra_hosts=self._extra_hosts,
             )
 
         try:
diff --git a/samcli/local/lambdafn/runtime.py b/samcli/local/lambdafn/runtime.py
index 83af384d..88104464 100644
--- a/samcli/local/lambdafn/runtime.py
+++ b/samcli/local/lambdafn/runtime.py
@@ -67,6 +67,10 @@ class LambdaRuntime:
             Debugging context for the function (includes port, args, and path)
         container_host string
             Host of locally emulated Lambda container
+        container_host_interface string
+            Optional. Interface that Docker host binds ports to
+        extra_hosts Dict
+            Optional. Dict of hostname to IP resolutions
 
         Returns
         -------
@@ -116,7 +120,15 @@ class LambdaRuntime:
             LOG.debug("Ctrl+C was pressed. Aborting container creation")
             raise
 
-    def run(self, container, function_config, debug_context, container_host=None, container_host_interface=None):
+    def run(
+        self,
+        container,
+        function_config,
+        debug_context,
+        container_host=None,
+        container_host_interface=None,
+        extra_hosts=None,
+    ):
         """
         Find the created container for the passed Lambda function, then using the
         ContainerManager run this container.
@@ -134,6 +146,8 @@ class LambdaRuntime:
             Host of locally emulated Lambda container
         container_host_interface string
             Optional. Interface that Docker host binds ports to
+        extra_hosts Dict
+            Optional. Dict of hostname to IP resolutions
 
         Returns
         -------
@@ -142,7 +156,13 @@ class LambdaRuntime:
         """
 
         if not container:
-            container = self.create(function_config, debug_context, container_host, container_host_interface)
+            container = self.create(
+                function_config=function_config,
+                debug_context=debug_context,
+                container_host=container_host,
+                container_host_interface=container_host_interface,
+                extra_hosts=extra_hosts,
+            )
 
         if container.is_running():
             LOG.info("Lambda function '%s' is already running", function_config.full_path)


Test patch:
diff --git a/tests/unit/local/lambdafn/test_runtime.py b/tests/unit/local/lambdafn/test_runtime.py
index dd7dfba1..c7eb7883 100644
--- a/tests/unit/local/lambdafn/test_runtime.py
+++ b/tests/unit/local/lambdafn/test_runtime.py
@@ -226,7 +226,13 @@ class LambdaRuntime_run(TestCase):
         create_mock.return_value = container
 
         self.runtime.run(None, self.func_config, debug_context=debug_options)
-        create_mock.assert_called_with(self.func_config, debug_options, None, None)
+        create_mock.assert_called_with(
+            function_config=self.func_config,
+            debug_context=debug_options,
+            container_host=None,
+            container_host_interface=None,
+            extra_hosts=None,
+        )
         self.manager_mock.run.assert_called_with(container)
 
     def test_must_skip_run_running_container(self):