Sunday, March 14, 2021

Manage Your AWS Account from AWS Lambda with AWS Chalice

Analytics

Awesome AWS Chalice

AWS Chalice (join us in our community Slack channel) is Amazon Web Services' premier solution to writing infinitely scalable serverless Python applications based on AWS Lambda. Chalice provides an extensible build process via chalice generate-pipeline, allowing you to orchestrate the deployment (chalice deploy) of any dependencies or outputs, such as infrastructure code written in the CDK, executable artifacts, backend APIs or front-end applications. Chalice is suited for:

  • Writing https APIs that wrap infrastructure on AWS.
  • Building libraries of Ops functions (DevOps, DevSecOps, NetDevOps, NetOps, NetSecOps, CI/CD Pipeline, ChatOps, etc.).
  • Managing AWS accounts programatically.
  • Creating web applications with your favorite front-end toolkit (or AWS Amplify).
  • Providing the web API backend layer to cross-platform Win/Mac/Linux/Android/iOS desktop and mobile applications written in Qt for Python (PySide6).

Chalice's design is based on decorators. It is written by the AWS Chalice team. Think of Chalice as your primary entry point to whatever it is that you want to do on AWS, or in the cloud.

Contents

AWS Projects

  • AWS Cloud Development Kit (CDK) aws.amazon.com
    • The AWS CDK is written in Javascript and, via JSii, is available to Python. With the chalice-cdk CDK Construct for Chalice you can deploy your Chalice application via cdk deploy. Alternately, with Chalice's chalice generate-pipeline extensible build process, you can deploy your CDK infrastructure when you deploy your Chalice application. In other words, you can either use the CDK to deploy your Chalice application, or use Chalice to deploy your CDK application. If you primarily write Chalice applications, you can use the CDK primarily for deploying your infrastructure layer.
  • AWS Solutions Constructs Patterns aws.amazon.com
    • These are vetted architectural patterns for the AWS CDK that allow you to easily chain together multiple products per solutions construct, and to also chain those patterns together. Many of the patterns are serverless in nature.
  • AWS Serverless Application Repository aws.amazon.com
    • Weave these serverless applications into your Chalice application, such as the AthenaDynamoDBConnector which allows you to query DynamoDB using SQL via Athena. Take note that while many are published by AWS teams, some of these applications are published by third parties and should be evaluated before being put into production.
  • JSii GitHub
    • JSii is the library that enables the AWS CDK to generalize from Javascript to Python. You can use JSii to call CDK code that may not have been interfaced to Python in a CDK Construct yet.
  • DynamoDB Global Tables aws.amazon.com
    • A fully managed extension to DynamoDB for global NoSQL scale-out of your Chalice application.
  • Aurora Serverless Global Database 2 aws.amazon.com
    • A serverless OLTP database for your Chalice application that scales out to hundreds of thousands of transactions per second, with secondary cluster replications in up to 5 regions. Rumor has it that it runs Amazon.com.
  • AWS Amplify docs.amplify.aws
    • In particular the Amplify UI Components, written in Javascript. Chalice makes it easy to create routing-based APIs that wrap the heavy lifting, while Amplify helps with the front-end Javascript, such as reactive programming based on React. You can use Chalice's built-in support for authorization via Cognito user pools, and you can pair Amplify's support for GraphQL with the Chalice-GraphQL 3rd-party library. You can also use Amplify CLI to deploy your Chalice application.
  • Amazon Athena Federated Query docs.aws.amazon.com
    • This allows you to write Athena -data source connector- Lambda functions that can be used to query across hybrid data sources achieving a mesh topology for your ad-hoc Data Lake. You can write these data source connectors with Chalice using its ability to create pure Lambda functions, and run your federated queries from Chalice in SQL using a third party module such as SQLAlchemy.

AWS Python SDKs

  • AWS SDK for Python (boto3) boto3.amazonaws.com
    • In addition to providing Python interfaces to most AWS services, Amazon will often release setup/teardown code for new services as boto3 scripts (i.e. AWS Detective and AWS GuardDuty) before they are available in CloudFormation or the CDK. You can modify these scripts to be run from Chalice. There is also an -asynchronous- version of boto3 available, aioboto3, that is compatible with Python 3's built-in async and await asynchronous programming keywords. With aioboto3 you can, for example, perform massively parallel writes and reads to S3 or DynamoDB.
  • AWS X-Ray SDK for Python docs.aws.amazon.com
    • The X-Ray SDK for Python is a must have for using the X-Ray console to trace and visualize your Chalice-based microservices architecture. In addition, this SDK can dynamically instrument tracing into other libraries that are useful for Chalice, such as boto3, aioboto3, pynamodb, sqlite3, psycopg2, pymongo and PyMySQL using from aws_xray_sdk.core import patch_all;patch_all();
  • AWS IoT SDK for Python GitHub
  • AWS C Common Runtime GitHub
    • The most high performance Python-on-AWS applications may make use of the AWS C Common Runtime, which is written in.. C! You'll need to use the AWS CRT Python module to make the magic happen.
  • AWS Encryption SDK for Python GitHub
    • This is a client-side encryption library, meaning a library for using hard encryption hosted by AWS, in your application logic.
  • AWS SageMaker SDK for Python GitHub
    • This SDK allows you to train and deploy machine learning models in Python, from Chalice, in frameworks such as TensorFlow, MXNet, or models that you created in SageMaker. It also supports hosting Apache SparkML models, allowing you to integrate with your AWS EMR cluster.
  • AWS Step Functions Data Science SDK for Python GitHub
    • This SDK is for data scientists who want to create workflows that train and publish machine learning models, as orchestrated by AWS Step Functions, without having to worry about provisioning infrastructure.
  • AWS Braket SDK for Python GitHub
    • This SDK allows you to interact with D-Wave quantum computing devices on AWS Braket from Chalice, enabling applications from quantum annealing to random number generation.
  • AWS DynamoDB Encryption SDK for Python GitHub
    • This client-side SDK helps you encrypt your sensitive data before sending it to DynamoDB.

AWS Samples for Python

AWS Samples are example solution architectures created by AWS and published on GitHub. Here is the complete list of 500+ Python samples. This section contains the best serverless samples, which you can use as inspiration.

AWS Labs Samples

Sample serverless solution architectures code in Python from AWS Labs, which tends to be more feature complete than AWS Samples.

3rd Party Tools

  • PynamoDB: A Pythonic wrapper for DynamoDB GitHub
    • PynamoDB is a pythonic interface to DynamoDB for data modelling. Example: terraform-registry. GitHub
  • PySide6 qt.io
    • PySide6 is the official Qt module for Python, for writing cross-platform Win/Mac/Linux/Android/iOS applications. With PySide6 and QtQuick you can very quickly write desktop Python applications that integrate with Chalice. You can use Chalice to authenticate via Cognito user pools, and to write an API layer for your application that is backed by any AWS service. You can use Chalice's extensible build system to create and publish cross-platform Qt executables.
  • Hy: A lisp written in Python hylang.org
    • Hy is a multi-paradigm general-purpose programming language in the Lisp family, inspired by Clojure and written in Python. You can use it to pipeline Chalice λ functions together (functional programming), achieving lambda-based programming that is as effortless as Bash pipelines on the Linux command line. You can mix Hy and Python in the same file.
  • Toolz: A set of utility functions for iterators, functions, and dictionaries GitHub
    • Toolz is a python module that allows you to import functional programming primitives, going beyond Python's built-in map-reduce-filter idioms.

Tooling for Writing Chalice Code

Blog Posts and Feature Releases

Built on Chalice

Miscellaneous Awesomeness

Stack Overflow

Chalice Documentation

Paid Tracing

Videos

Support

Misc

  • Steampipe steampipe.io #2BBA9C
    • Steampipe allows you to query your AWS infrastructure, IAM policies, etc., using SQL.
  • Click PalletsProjects #2BBA9C
    • You can pair Flask's Click project to decorate your Chalice apps so as to have a CLI.
  • AWS CDK Patterns GitHub #2BBA9C


from Hacker News https://ift.tt/3qF1bVL

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.