
Integration tests run against deployed cloud resources. Since local unit tests cannot adequately test IAM permissions, our integration tests confirm that permissions are properly configured. Run integration tests against your deployed cloud resources with the following command:
# Set the environment variable AWS_SAM_STACK_NAME to the name of the stack you specified during deploy
AWS_SAM_STACK_NAME=<stack-name> python3 -m pytest -s tests/integration -v
The AWS CLI enables you to invoke a Lambda function in the cloud.
# invoke a Lambda function in the cloud using the AWS CLI. Substitute the function name as created in your stack.
aws lambda invoke --function-name apigw-lambda-PythonTestDemo-6Ecinx8IauZv outfile.txt
AWS SAM Accelerate is a set of features that reduces deployment latency and enable developers to test their code quickly against production AWS services in the cloud. To learn more watch the video or read the blog post.
# synchronize local code with the cloud
sam sync --watch --stack-name apigw-lambda
Now find the Lambda handler function in the src\app.py file. Make a change to the print statement on line 26 and notice what happens in your sync window.