AWS re:Invent 2023 - The pragmatic serverless Python developer (OPN305) Flashcards

https://www.youtube.com/watch?v=52W3Qyg242Y

1
Q

What is Pydantic?

A

It is data validation library for Python.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How structure the folder?

A

Business domain: lambda handlers code
Business logic
integrations code

Ex:
- Product
- crud
- handlers
- schemas (pydantic models)
- tests
- e2e
- integration
- unit
- pyproject.toml
- IaC: CDK, AWS SAM, Terraform, …

Ex 2:
- stream_processor
- domain_logic
- handlers
- integrations
- __init__.py
- constants.py

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Architectural Layers?

A

Is a way to split responsibility.

Handler:
- No domain code
- Concise responsibilities
-> Configuration > Env. vars > Validation > Call domain > Serialize output

Domain:
- Business logic only
- May be shared by N handlers
- Isolated tests

Integration:
- Adapter pattern
- Contains API/DB code

API Gateway > Handler > Domain > Integration > DynamoDb

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain how test a serverless application?

A
  • Unit test (locally)
    • test schema validations (Pydantic)
    • test isolated integration classes
    • no deployment required
    • fast and repeatable
  • Integration tests
    • requires deployment
    • Run locally & on AWS
    • Test runner (pytest) > test data > call > lambda handler (AWS) > assertion
  • E2E test
    • required deployment
    • Run on AWS
    • Test runner (pytest) > test data > (call) > Product API (Api Gateway endpoint + lambda) > assertion
    • Simulate bad input
    • API security tests (invalid authorization / invalida authentication)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly