Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Money-saving tips for the frugal serverless dev...

Money-saving tips for the frugal serverless developer

Presented at AWS Community Day Turkey 2024

Yan Cui

May 18, 2024
Tweet

More Decks by Yan Cui

Other Decks in Technology

Transcript

  1. How to keep CloudWatch Logs cost under control 1. Do

    structured logging. DEBUG INFO WARN ERROR Detailed events for debugging application. General information that highlights progress of application. Potential problems, but doesn’t stop application from working. Issues that require immediate attention.
  2. How to keep CloudWatch Logs cost under control 1. Do

    structured logging. Log at INFO or above in production. DEBUG INFO WARN ERROR Detailed events for debugging application. General information that highlights progress of application. Potential problems, but doesn’t stop application from working. Issues that require immediate attention.
  3. How to keep CloudWatch Logs cost under control 1. Do

    structured logging. Log at INFO or above in production. 2. Sample DEBUG logs in production. e.g. 5% of invocations.
  4. How to keep CloudWatch Logs cost under control 1. Do

    structured logging. Log at INFO or above in production. 2. Sample DEBUG logs in production. e.g. 5% of invocations. 3. Set log retention to 30 days.
  5. CloudWatch Logs AWS Lambda AWS Lambda stdout asynchronously invokes any

    log aggregation service double paying for logs
  6. Law I. Make Cost a Non-functional Requirement. Law II. Systems

    that Last Align Cost to Business. Law III. Architecting is a Series of Trade-offs. Law IV. Unobserved Systems Lead to Unknown Costs. Law V. Cost Aware Architectures Implement Cost Controls. Law VI. Cost Optimization is Incremental. Law VII. Unchallenged Success Leads to Assumptions.
  7. Law I. Make Cost a Non-functional Requirement. Law II. Systems

    that Last Align Cost to Business. Law III. Architecting is a Series of Trade-offs. Law IV. Unobserved Systems Lead to Unknown Costs. Law V. Cost Aware Architectures Implement Cost Controls. Law VI. Cost Optimization is Incremental. Law VII. Unchallenged Success Leads to Assumptions.
  8. IOT core AppSync API Gateway Messages Connection Time $2 per

    million $0.08 per million mins $0.25 per million mins $1 per million $0.08 per million mins $1 per million
  9. IOT core AppSync API Gateway Messages Connection Time $2 per

    million $0.08 per million mins $0.25 per million mins $1 per million $0.08 per million mins $1 per million Momento - - Data Transfer $0.5 / GB EC2 rates EC2 rates EC2 rates
  10. Have to write Lambdaliths (No per-endpoint metrics & alerts, no

    fi ne-grained access control, no per-endpoint auth)
  11. Have to write Lambdaliths (No per-endpoint metrics & alerts, no

    fi ne-grained access control, no per-endpoint auth) (Large frameworks a ff ect cold start performance)
  12. 1. Billing alarms 2. Keeping logging cost under control 3.

    Right-sizing Lambda functions 4. Caching 5. Route53 TTL 6. Avoid CORS 7. Choosing the right service 8. Simplify your architecture 9. Function URLs 10. Functionless 11. Direct client access to AWS
  13. productionreadyserverless.com Join 20+ AWS Heroes & Community Builders and 1000+

    happy students in levelling up your serverless game.