From f7b8a9221209e3f5f7ae4d831f540518ffaecba5 Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Tue, 20 Feb 2024 23:06:46 +0000 Subject: [PATCH] AWSLambda: Improve docs (#7374) --- docs/docs/configuration/index.rst | 3 +++ moto/awslambda/models.py | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/docs/configuration/index.rst b/docs/docs/configuration/index.rst index db38ad1aa..c2e8b7ad1 100644 --- a/docs/docs/configuration/index.rst +++ b/docs/docs/configuration/index.rst @@ -49,6 +49,9 @@ That is why Moto resets the `boto3-Session`, to make sure that it is recreated w If all of your tests use Moto, and you never want to reach out to AWS, you can choose to _not_ reset the `boto3-session`. New boto3-clients that are created will reuse the `boto3-Session` (with fake credentials), making Moto much more performant. +Other configuration options +--------------------------- + .. toctree:: :maxdepth: 1 diff --git a/moto/awslambda/models.py b/moto/awslambda/models.py index 8b6ca83a9..46ac998f4 100644 --- a/moto/awslambda/models.py +++ b/moto/awslambda/models.py @@ -1815,7 +1815,9 @@ class LambdaBackend(BaseBackend): Implementation of the AWS Lambda endpoint. Invoking functions is supported - they will run inside a Docker container, emulating the real AWS behaviour as closely as possible. - It is possible to connect from AWS Lambdas to other services, as long as you are running MotoProxy or the MotoServer. + .. warning:: When invoking a function using the decorators, the created Docker container cannot reach Moto (or it's in-memory state). Any AWS SDK-requests within your Lambda will try to connect to AWS instead. + + It is possible to connect from AWS Lambdas to other services, as long as you are running MotoProxy or the MotoServer in a Docker container. When running the MotoProxy, calls to other AWS services are automatically proxied. @@ -1876,15 +1878,13 @@ class LambdaBackend(BaseBackend): MOTO_LAMBDA_DATA_DIR=/tmp/data - .. note:: When using the decorators, a Docker container cannot reach Moto, as the Docker-container loses all mock-context. Any boto3-invocations used within your Lambda will try to connect to AWS. - _-_-_-_ If you want to mock the Lambda-containers invocation without starting a Docker-container, use the simple decorator: .. sourcecode:: python - @mock_lambda_simple + @mock_aws(config={"lambda": {"use_docker": False}}) """