powertools-lambda-python
serverless-application-model
powertools-lambda-python | serverless-application-model | |
---|---|---|
20 | 12 | |
2,640 | 7,669 | |
2.7% | - | |
9.9 | 7.1 | |
2 days ago | over 3 years ago | |
Python | Python | |
MIT No Attribution | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
powertools-lambda-python
-
Superpower REST API DX with Serverless ⚡ and DevOps Best Practices on AWS (🐍 Python Version)
Also I suggest to have a look at AWS Lambda PowerTools, which simplifies adopting best practices with Lambda
-
AWS Serverless Diversity: Multi-Language Strategies for Optimal Solutions
Python is a natural fit for serverless development. It boasts a vast array of libraries, including Powertools for AWS and robust libraries for data engineers. Its versatility and excellent developer experience make it a top choice for serverless projects, offering a seamless and enjoyable development experience.
-
Turbocharge your Lambda Functions with AWS Lambda Powertools for Python
Read more: https://docs.powertools.aws.dev/lambda/python/latest/
-
Billing for SaaS with EMF and CloudWatch Metric Streams
Imagine a sample Python application returning "hello world" to simulate a successful call. Each call to the application is captured for billing purposes using EMF. Lambda Powertools is used to reduce the amount of code we need to write.
-
Serverless Site Health Check Notification System
Below is an example of lambda handler code. It is using the highly recommended Powertools for AWS Lambda library to ensure best practices around tracing, logging, metrics, and more. The function gets passed an SNS topic and Slack webhook URL at creation time (via environment variables) to send notifications to. It parses the passed in event information to determine which hostname had it's status changed and what the new status is and sends out notifications.
- Advice for unattended vending machine startup with basic api, crud, and database needs
-
Investigating Pydantic v2's Bold Performance Claims
It's worth noting that these improvements will also impact other libraries and frameworks that rely on Pydantic, such as FastAPI and AWS Lambda Powertools, which could deliver some transitive performance improvements to various projects that don't directly depend on Pydantic themselves.
-
AWS Lambda Cookbook — Elevate your handler’s code — Part 5— Input Validation
I had the pleasure of writing and contributing the Parser utility to a fantastic project on Github called AWS Lambda Powertools. We have used this repository previously in the blog series (parts one to three) for logging, tracing and metrics.
-
Deploying CDK Lambda with Docker and Gitlab CI
We are going to add aws-lambda-powertools as poetry dependency we need. While this is available as Lambda Layer, we are going to use it as a installed dependency for this exercise.
-
How working with AWS open-source tools made me a better developer
I truly disliked type hints. Working with CDK started to change that for the better and then I discovered AWS Lambda Powertools. It combines multiple things I am passionate about so I became passionate about using the library and improving it. Lambda Powertools utilizes static typing for several of its main features (Parser, Event Sources and Typing).
serverless-application-model
-
Streamline AWS Development with CI/CD, SAM, and GitHub Actions
Resources: HelloWorldFunction: Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction Properties: CodeUri: hello_world/ Handler: app.lambda_handler Runtime: python3.9 Architectures: - x86_64 Events: HelloWorld: Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api Properties: Path: /hello Method: get
-
AWS Prefix Lists for the Organization
Parameters: AppConfigAppName: Type: String Description: AppConfig Application Name Default: aws-ip-ranges AppConfigAppEnvironmentName: Type: String Description: AppConfig Application Environment Name Default: dev AppConfigName: Type: String Description: AppConfig Name Default: services AppConfigLayerArn: Type: String Description: Retrieve AWS AppConfig Lambda extension arn from `https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-integration-lambda-extensions-versions.html#appconfig-integration-lambda-extensions-enabling-x86-64` Default: arn:aws:lambda:ap-southeast-2:080788657173:layer:AWS-AppConfig-Extension:91 AwsOrgArn: Type: String Description: The ARN of the AWS Organization used to share Prefix Lists Default: notset Resources: SAMConfigApplication: Type: AWS::AppConfig::Application Properties: Name: !Ref AppConfigAppName Environment: Type: AWS::AppConfig::Environment Properties: Name: !Ref AppConfigAppEnvironmentName ApplicationId: !Ref SAMConfigApplication SAMConfigConfigurationProfile: Type: AWS::AppConfig::ConfigurationProfile Properties: ApplicationId: !Ref SAMConfigApplication Name: !Ref AppConfigName Type: 'AWS.Freeform' LocationUri: 'hosted' SAMConfigDeploymentStrategy: Type: AWS::AppConfig::DeploymentStrategy Properties: Name: "SAMConfigDeploymentStrategy" Description: "A deployment strategy to deploy the config immediately" DeploymentDurationInMinutes: 0 FinalBakeTimeInMinutes: 0 GrowthFactor: 100 GrowthType: LINEAR ReplicateTo: NONE BasicHostedConfigurationVersion: Type: AWS::AppConfig::HostedConfigurationVersion Properties: ApplicationId: !Ref SAMConfigApplication ConfigurationProfileId: !Ref SAMConfigConfigurationProfile Description: 'AWS Service configuration for update-aws-ip-ranges' ContentType: 'application/json' Content: | { "Services": [ { "Name": "CODEBUILD", "Regions": [ "ap-southeast-2" ], "PrefixList": { "Enable": true, "Summarize": true }, "WafIPSet": { "Enable": true, "Summarize": true, "Scopes": [ "REGIONAL" ] } } ] } AppConfigDeployment: Type: AWS::AppConfig::Deployment Properties: ApplicationId: !Ref SAMConfigApplication ConfigurationProfileId: !Ref SAMConfigConfigurationProfile ConfigurationVersion: !Ref BasicHostedConfigurationVersion DeploymentStrategyId: !Ref SAMConfigDeploymentStrategy EnvironmentId: !Ref Environment LambdaUpdateIPRanges: Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction Properties: CodeUri: src/ Handler: app.lambda_handler Runtime: python3.9 Architectures: - x86_64 Environment: Variables: APP_CONFIG_APP_NAME: !Ref AppConfigAppName APP_CONFIG_APP_ENV_NAME: !Ref AppConfigAppEnvironmentName APP_CONFIG_NAME: !Ref AppConfigName AWS_ORG_ARN: !Ref AwsOrgArn LOG_LEVEL: INFO Layers: - !Ref AppConfigLayerArn
-
AWS Cloud Quest: Templating Serverless Applications
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: > appfn Sample SAM Template for appfn # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst Globals: Function: Timeout: 3 Resources: HelloWorldFunction: Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction Properties: CodeUri: hello_world/ Handler: app.lambda_handler Runtime: python3.7 Events: HelloWorld: Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api Properties: Path: /hello Method: get DynamoDBTable: Type: AWS::DynamoDB::Table Properties: AttributeDefinitions: - AttributeName: id AttributeType: S KeySchema: - AttributeName: id KeyType: HASH ProvisionedThroughput: ReadCapacityUnits: 5 WriteCapacityUnits: 5 StreamSpecification: StreamViewType: NEW_IMAGE Outputs: # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function # Find out more about other implicit resources you can reference within SAM # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api HelloWorldApi: Description: "API Gateway endpoint URL for Prod stage for Hello World function" Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" HelloWorldFunction: Description: "Hello World Lambda Function ARN" Value: !GetAtt HelloWorldFunction.Arn HelloWorldFunctionIamRole: Description: "Implicit IAM Role created for Hello World function" Value: !GetAtt HelloWorldFunctionRole.Arn
-
Crud Dynamodb usando funciones lambdas y apigateway
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: > crud-products-serverless Sample SAM Template for crud-products-serverless # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst Globals: Function: CodeUri: app Timeout: 10 Tracing: Active Runtime: nodejs16.x Architectures: - x86_64 Environment: Variables: TABLE_NAME: !Ref ProductTable Api: TracingEnabled: True Resources: CreateProductFunction: Type: AWS::Serverless::Function Properties: Handler: src/functions/create.handler Events: CreateProduct: Type: Api Properties: Path: /products Method: post Policies: - DynamoDBCrudPolicy: TableName: !Ref ProductTable Metadata: BuildMethod: esbuild BuildProperties: Minify: true Target: "es2020" EntryPoints: - src/functions/create.ts UpdateProductFunction: Type: AWS::Serverless::Function Properties: Handler: src/functions/updateById.handler Events: CreateProduct: Type: Api Properties: Path: /products Method: put Policies: - DynamoDBCrudPolicy: TableName: !Ref ProductTable Metadata: BuildMethod: esbuild BuildProperties: Minify: true Target: "es2020" EntryPoints: - src/functions/updateById.ts DeleteByIdProductFunction: Type: AWS::Serverless::Function Properties: Handler: src/functions/deleteById.handler Events: CreateProduct: Type: Api Properties: Path: /products/{id} Method: delete Policies: - DynamoDBCrudPolicy: TableName: !Ref ProductTable Metadata: BuildMethod: esbuild BuildProperties: Minify: true Target: "es2020" EntryPoints: - src/functions/deleteById.ts GetAllProductsFunction: Type: AWS::Serverless::Function Properties: Handler: src/functions/getAll.handler Events: CreateProduct: Type: Api Properties: Path: /products Method: get Policies: - DynamoDBCrudPolicy: TableName: !Ref ProductTable Metadata: BuildMethod: esbuild BuildProperties: Minify: true Target: "es2020" EntryPoints: - src/functions/getAll.ts GetProductByIdFunction: Type: AWS::Serverless::Function Properties: Handler: src/functions/getById.handler Events: CreateProduct: Type: Api Properties: Path: /products/{id} Method: get Policies: - DynamoDBCrudPolicy: TableName: !Ref ProductTable Metadata: BuildMethod: esbuild BuildProperties: Minify: true Target: "es2020" EntryPoints: - src/functions/getById.ts ProductTable: Type: AWS::DynamoDB::Table Properties: TableName: !Sub ${AWS::StackName}-products AttributeDefinitions: - AttributeName: id AttributeType: S KeySchema: - AttributeName: id KeyType: HASH BillingMode: PAY_PER_REQUEST
-
Deploying Docker Containers to Lambda using AWS SAM and CodePipeline (Part 1)
Resources: HelloWorldAPI: Type: AWS::Serverless::Api Properties: Name: Hello World API StageName: Prod HelloWorldFunction: Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction Properties: PackageType: Image ImageConfig: Command: ["app.lambda_handler"] Events: HelloWorld: Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api Properties: RestApiId: !Ref HelloWorldAPI Path: /hello Method: get Metadata: Dockerfile: hello_world_docker DockerContext: . DockerTag: v1
-
AWS SAM and Go
# This is the SAM template that represents the architecture of your serverless application # https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-template-basics.html # The AWSTemplateFormatVersion identifies the capabilities of the template # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/format-version-structure.html AWSTemplateFormatVersion: 2010-09-09 Description: >- Any description you want # Transform section specifies one or more macros that AWS CloudFormation uses to process your template # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-section-structure.html Transform: - AWS::Serverless-2016-10-31 # Resources declares the AWS resources that you want to include in the stack # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst Globals: Function: Timeout: 200 Runtime: go1.x Environment: Variables: AnyParameterYouWant: !Ref AnyParameterYouWant #this parameter is injected in all lambdas in this file Parameters: stage: Type: String Default: homologation AnyParameterYouWant: Type: String Default: this-stage-is-${stage} Resources: HelloWorldFunction: Type: AWS::Serverless::Function Properties: FunctionName: !Sub helloWorld-${stage} PackageType: Zip CodeUri: src/main Handler: lambda Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html MemorySize: 1024 Events: Schedule: Type: Schedule Properties: Schedule: 'rate(5 minutes)' Name: !Sub HelloWorld-${stage} #this is a name of schedule this approach change by stage name Description: HelloWorldFunction Enabled: true HelloWorldLogGroup: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub /aws/lambda/${HelloWorldFunction} RetentionInDays: 30 DependsOn: HelloWorldFunction
-
AWS SAM Layer can't be deployed
Resources: SQLLayer: Type: AWS::Serverless::LayerVersion Properties: LayerName: sql-dependencies Description: sql dependencies ContentUri: layers/SQLLayer/ CompatibleRuntimes: - nodejs14.x LicenseInfo: 'MIT' RetentionPolicy: Retain Metadata: # Manage esbuild properties BuildMethod: nodejs14.x onSignup: Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction Properties: CodeUri: lambdas/onSignup/ Handler: app.lambdaHandler Runtime: nodejs14.x Timeout: 10 Architectures: - x86_64 Layers: - !Ref SQLLayer Metadata: # Manage esbuild properties BuildMethod: esbuild BuildProperties: Minify: true Target: "es2020" Sourcemap: true EntryPoints: - app.ts
-
My first application in AWS Serverless Application Repository
SAM makes it very easy to get started with creating Serverless apps and maintain them as they start getting more and more complex and involved. For more information on SAM , check this out - https://github.com/awslabs/serverless-application-model
-
A Serverless API to validate AWS Access Keys based on AWS SAM
However , AWS_IAM authorization is not supported in the implicit API declaration as detailed here :https://github.com/awslabs/serverless-application-model/issues/25
-
Deploying CI/CD For NodeJS Serverless Applications Workshop: Part V
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: > sam-app Sample SAM Template for sam-app Globals: Function: Timeout: 3 Resources: HelloWorldFunction: Type: AWS::Serverless::Function Properties: CodeUri: hello-world/ Handler: app.lambdaHandler Runtime: nodejs14.x AutoPublishAlias: live DeploymentPreference: Type: Canary10Percent5Minutes Alarms: - !Ref CanaryErrorsAlarm Events: HelloWorld: Type: Api Properties: Path: /hello Method: get CanaryErrorsAlarm: Type: AWS::CloudWatch::Alarm Properties: AlarmDescription: Lambda function canary errors ComparisonOperator: GreaterThanThreshold EvaluationPeriods: 2 MetricName: Errors Namespace: AWS/Lambda Period: 60 Statistic: Sum Threshold: 0 Dimensions: - Name: Resource Value: !Sub "${HelloWorldFunction}:live" - Name: FunctionName Value: !Ref HelloWorldFunction - Name: ExecutedVersion Value: !GetAtt HelloWorldFunction.Version.Version Outputs: # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function # Find out more about other implicit resources you can reference within SAM # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api HelloWorldApi: Description: "API Gateway endpoint URL for Prod stage for Hello World function" Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" HelloWorldFunction: Description: "Hello World Lambda Function ARN" Value: !GetAtt HelloWorldFunction.Arn HelloWorldFunctionIamRole: Description: "Implicit IAM Role created for Hello World function" Value: !GetAtt HelloWorldFunctionRole.Arn
What are some alternatives?
powertools-lambda-java - Powertools is a developer toolkit to implement Serverless best practices and increase developer velocity.
scryfall-telegram - Telegram bot backed by the Scryfall.com Magic:The Gathering API. Runs Serverless.
powertools-lambda-typescript - Powertools is a developer toolkit to implement Serverless best practices and increase developer velocity.
cookiecutter-aws-sam-s3-rekognition-dynamodb-python - SAM app that uses AWS Rekognition APIs to detect text in S3 Objects and stores the text in DynamoDB.
unlock-mainframe-data-files-on-aws - This solution is designed to help you unlock legacy mainframe data by migrating data files from mainframe systems to AWS. By migrating the data, you can make use of the powerful analytics, machine learning, and other services available in AWS to gain insights and make better decisions based on the data.
startbootstrap-bare - A bare Bootstrap HTML starter template for rapid development - created by Start Bootstrap
tz - Time zone database and code
update-aws-ip-ranges - Lambda function that creates or updates AWS resource with AWS service's IP ranges from the ip-ranges.json file. Configure which service and region. Configure to which resources you want to create or update with those ranges. It supports WAF IPSet and VPC Prefix List and sharing via Resource Access Manager.
aws-lambda-web-adapter - Run web applications on AWS Lambda
aws-cdk - The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
python-flask-template - HTTP and Flask-based OpenFaaS templates for Python 3
aws-lambda-series - Examples how using aws sam and Go