Skip to content

Commit

Permalink
chore: Update pip and log retention (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
ran-isenberg authored Aug 5, 2022
1 parent 807d0cc commit bbf9239
Show file tree
Hide file tree
Showing 9 changed files with 227 additions and 124 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"cSpell.words": [
"appconfig",
"Codecov",
"ranisenberg"
"ranisenberg",
"runtimes"
]
}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


dev:
pipenv install --dev
pipenv install -d
make deps

lint:
Expand All @@ -23,7 +23,7 @@ pre-commit:
pre-commit run -a

deps:
pipenv lock -r -d > dev_requirements.txt
pipenv lock --dev-only -r > dev_requirements.txt
pipenv lock -r > lambda_requirements.txt

unit:
Expand Down
184 changes: 132 additions & 52 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cdk/aws_lambda_handler_cookbook/service_stack/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
POWERTOOLS_TRACE_DISABLED = 'POWERTOOLS_TRACE_DISABLED'
POWER_TOOLS_LOG_LEVEL = 'LOG_LEVEL'
BUILD_FOLDER = '.build/lambdas/'
COMMION_LAYER_BUILD_FOLDER = '.build/common_layer'
COMMON_LAYER_BUILD_FOLDER = '.build/common_layer'
ENVIRONMENT = 'dev'
CONFIGURATION_NAME = 'my_conf'
CONFIGURATION_MAX_AGE_MINUTES = '5' # time to store appconfig conf in the cache before refetching it
CONFIGURATION_MAX_AGE_MINUTES = '5' # time to store app config conf in the cache before refetching it


def get_stack_name() -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from aws_cdk import CfnOutput, Duration, RemovalPolicy, aws_apigateway
from aws_cdk import aws_iam as iam
from aws_cdk import aws_lambda as _lambda
from aws_cdk import aws_logs
from aws_cdk.aws_lambda_python_alpha import PythonLayerVersion
from constructs import Construct

Expand Down Expand Up @@ -56,7 +57,7 @@ def _build_common_layer(self) -> PythonLayerVersion:
return PythonLayerVersion(
self,
'CommonLayer',
entry=constants.COMMION_LAYER_BUILD_FOLDER,
entry=constants.COMMON_LAYER_BUILD_FOLDER,
compatible_runtimes=[_lambda.Runtime.PYTHON_3_8],
removal_policy=RemovalPolicy.DESTROY,
)
Expand Down Expand Up @@ -84,6 +85,7 @@ def __add_post_lambda_integration(self, api_name: aws_apigateway.Resource, role:
memory_size=constants.API_HANDLER_LAMBDA_MEMORY_SIZE,
layers=[self.common_layer],
role=role,
log_retention=aws_logs.RetentionDays.ONE_DAY,
)

# POST /api/service/
Expand Down
2 changes: 1 addition & 1 deletion cdk/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
install_requires=[
'aws-cdk-lib>=2.0.0',
'constructs>=10.0.0',
'aws-cdk.aws-lambda-python-alpha==2.32.1-alpha.0',
'aws-cdk.aws-lambda-python-alpha==2.35.0-alpha.0',
],
)
116 changes: 63 additions & 53 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,74 +1,84 @@
#
# These requirements were autogenerated by pipenv
# To regenerate from the project's Pipfile, run:
#
# pipenv lock --requirements --dev-only
#

-i https://pypi.org/simple
-e ./cdk
attrs==21.4.0
aws-cdk-lib==2.33.0
aws-cdk.aws-lambda-python-alpha==2.32.1a0
boto3==1.24.33
botocore==1.27.33
-e ./cdk
attrs==21.4.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
aws-cdk-lib==2.35.0; python_version ~= '3.7'
aws-cdk.aws-lambda-python-alpha==2.35.0a0; python_version ~= '3.7'
boto3==1.24.46; python_version >= '3.7'
botocore==1.27.46; python_version >= '3.7'
cattrs==1.10.0
certifi==2022.6.15
cfgv==3.3.1
charset-normalizer==2.1.0
click==8.1.3
colorama==0.4.5 ; python_version > '3.4'
constructs==10.1.51
coverage[toml]==6.4.2
certifi==2022.6.15; python_version >= '3.6'
cfgv==3.3.1; python_full_version >= '3.6.1'
charset-normalizer==2.1.0; python_version >= '3.6'
click==8.1.3; python_version >= '3.7'
colorama==0.4.5; python_version >= '3.5'
constructs==10.1.67; python_version ~= '3.7'
coverage[toml]==6.4.2; python_version >= '3.7'
distlib==0.3.5
filelock==3.7.1
flake8==4.0.1
future==0.18.2
filelock==3.7.1; python_version >= '3.7'
flake8==5.0.4
future==0.18.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
ghp-import==2.1.0
gitdb==4.0.9
gitdb==4.0.9; python_version >= '3.6'
gitpython==3.1.27
identify==2.5.2
idna==3.3
importlib-metadata==4.12.0 ; python_version < '3.10'
identify==2.5.3; python_version >= '3.7'
idna==3.3; python_version >= '3.5'
importlib-metadata==4.12.0; python_version < '3.10'
iniconfig==1.1.1
isort==5.10.1
jinja2==3.1.2
jmespath==1.0.1
jsii==1.62.0
jinja2==3.1.2; python_version >= '3.7'
jmespath==1.0.1; python_version >= '3.7'
jsii==1.63.2; python_version ~= '3.7'
mando==0.6.4
markdown==3.3.7
markupsafe==2.1.1
mccabe==0.6.1
mergedeep==1.3.4
markdown==3.3.7; python_version >= '3.6'
markupsafe==2.1.1; python_version >= '3.7'
mccabe==0.7.0; python_version >= '3.6'
mergedeep==1.3.4; python_version >= '3.6'
mkdocs-git-revision-date-plugin==0.3.2
mkdocs-material-extensions==1.0.3
mkdocs-material-extensions==1.0.3; python_version >= '3.6'
mkdocs-material==8.3.9
mkdocs==1.3.1
nodeenv==1.7.0
packaging==21.3
platformdirs==2.5.2
pluggy==1.0.0
mkdocs==1.3.1; python_version >= '3.6'
nodeenv==1.7.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'
packaging==21.3; python_version >= '3.6'
platformdirs==2.5.2; python_version >= '3.7'
pluggy==1.0.0; python_version >= '3.6'
pre-commit==2.20.0
publication==0.0.3
py==1.11.0
pycodestyle==2.8.0
pyflakes==2.4.0
pygments==2.12.0
pymdown-extensions==9.5
pyparsing==3.0.9
py==1.11.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
pycodestyle==2.9.1
pyflakes==2.5.0; python_version >= '3.6'
pygments==2.12.0; python_version >= '3.6'
pymdown-extensions==9.5; python_version >= '3.7'
pyparsing==3.0.9; python_full_version >= '3.6.8'
pytest-cov==3.0.0
pytest-html==3.1.1
pytest-metadata==2.0.2
pytest-metadata==2.0.2; python_version >= '3.7' and python_version < '4'
pytest-mock==3.8.2
pytest==7.1.2
python-dateutil==2.8.2
python-dateutil==2.8.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
python-dotenv==0.20.0
pyyaml-env-tag==0.1
pyyaml==6.0
pyyaml-env-tag==0.1; python_version >= '3.6'
pyyaml==6.0; python_version >= '3.6'
radon==5.1.0
requests==2.28.1
s3transfer==0.6.0
six==1.16.0
smmap==5.0.0
toml==0.10.2
tomli==2.0.1
typing-extensions==4.3.0
urllib3==1.26.10
virtualenv==20.15.1
watchdog==2.1.9
requests==2.28.1; python_version >= '3.7' and python_version < '4'
s3transfer==0.6.0; python_version >= '3.7'
setuptools==63.4.1; python_version >= '3.7'
six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
smmap==5.0.0; python_version >= '3.6'
toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
tomli==2.0.1; python_version >= '3.7'
typeguard==2.13.3; python_full_version >= '3.5.3'
typing-extensions==4.3.0; python_version >= '3.7'
urllib3==1.26.11; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4.0'
virtualenv==20.16.3; python_version >= '3.6'
watchdog==2.1.9; python_version >= '3.6'
xenon==0.9.0
yapf==0.32.0
zipp==3.8.1
zipp==3.8.1; python_version >= '3.7'
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ What makes an AWS Lambda handler resilient, traceable and easy to maintain? How

The project is a template project that is based on my AWS Lambda handler cookbook blog series that I publish in [ranthebuilder.cloud](https://www.ranthebuilder.cloud){:target="_blank" rel="noopener"} and attempt to answer those questions.

The GitHub template project can be found at [https://github.com/ran-isenberg/aws-lambda-handler-cookbook](https://github.com/ran-isenberg/aws-lambda-handler-cookbook){:target="_blank" rel="noopener"}.

- This project provides a working, open source based, AWS Lambda handler skeleton Python code including DEPLOYMENT code with CDK.

- The project deploys an API GW with an AWS Lambda integration under the path POST /api/service/.
Expand Down
31 changes: 19 additions & 12 deletions lambda_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
#
# These requirements were autogenerated by pipenv
# To regenerate from the project's Pipfile, run:
#
# pipenv lock --requirements
#

-i https://pypi.org/simple
aws-lambda-powertools==1.26.5
aws-lambda-powertools==1.27.0
aws-xray-sdk==2.10.0
boto3==1.24.33
botocore==1.27.33
dnspython==2.2.1
boto3==1.24.46; python_version >= '3.7'
botocore==1.27.46; python_version >= '3.7'
dnspython==2.2.1; python_version >= '3.6' and python_version < '4.0'
email-validator==1.2.1
fastjsonschema==2.16.1
idna==3.3
jmespath==1.0.1
idna==3.3; python_version >= '3.5'
jmespath==1.0.1; python_version >= '3.7'
pydantic[email]==1.9.1
python-dateutil==2.8.2
s3transfer==0.6.0
six==1.16.0
typing-extensions==4.3.0
urllib3==1.26.10
wrapt==1.14.1
python-dateutil==2.8.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
s3transfer==0.6.0; python_version >= '3.7'
six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
typing-extensions==4.3.0; python_version >= '3.7'
urllib3==1.26.11; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4.0'
wrapt==1.14.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'

0 comments on commit bbf9239

Please sign in to comment.