3

17 Open Source Projects at AWS Written in Rust

 1 year ago
source link: https://dzone.com/articles/17-open-source-projects-at-aws-written-in-rust
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

17 Open Source Projects at AWS Written in Rust

Have you found yourself asking, "Is Rust actually useful for me?" Here, find some examples of where it’s been useful.

Feb. 16, 23 · Analysis
Like (1)
742 Views

This article was authored by AWS Senior Software Developer Engineer, Tim McNamara, and published with permission.

Lots of people have been investigating Rust recently. That raises an important question: “Is Rust actually useful for me?” While we can’t tell you whether it’s appropriate for your use case, we can share some examples of where it’s been useful for us.

These projects serve as a representative sample of what we've created so far and provide a glimpse into our use of Rust. We hope that by inspecting the code, you can learn from our work and get inspired to experiment with Rust at your workplace. 

Keep in mind that this list is not exhaustive: there are more open-source projects to explore, particularly within the AWS and AWS Labs organizations in GitHub.  We hope you find these projects informative and valuable! 

Systems Programming

Rust rose to prominence as a systems programming language, offering memory safety benefits that are unavailable in its peer languages, such as C and C++. This field, specifically virtualization, is where AWS first utilized Rust for large-scale projects.

Bottlerocket

Bottlerocket is an operating system designed for hosting containers. It includes only the essential software required to run containers and ensures that the underlying software is always secure. For example, it’s impossible to SSH into a container running in Bottlerocket: running containers don’t even have a shell, let alone sshd.

Firecracker

Firecracker powers AWS Lambda and AWS Fargate. It runs workloads in lightweight virtual machines called micro VMs, which combine speed and flexibility (which we’re used to from containers) with security and isolation (which we’re used to from virtual machines).

Web Services

As Rust became increasingly commonplace within AWS, projects began to appear that were broader than the initial systems programming domain. It is now a language that has a strong user base developing web-facing services.

Rust Runtime for AWS Lambda

Serverless is becoming increasingly mainstream within the technology industry, and serverless Rust is an excellent way to make use of this new paradigm. The Rust Runtime for AWS Lambda provides a custom runtime for AWS Lambda that’s ergonomic to use and offers a performance boost versus other runtimes.

smithy-rs

Keeping servers and clients up-to-date as APIs change is a difficult task. The Smithy Interface Definition Language (IDL) simplifies this by delegating the bookkeeping to software. The Rust implementation is called smithy-rs. It can generate clients and servers in Rust while enabling business logic to be implemented within developers’ preferred languages such as Python. smithy-rs is an interesting project internally, as it is an example of using Kotlin and Rust within the same code base. smithy-rs is used to generate the open-source crates that belong to AWS SDK for Rust.

AWS SDK for Rust

The AWS SDK for Rust enables AWS services to be accessed programmatically from Rust programs. The whole SDK encompasses dozens of crates, each corresponding to an AWS service, all of which are available for inspection within the SDK’s GitHub repository.

Testing

While Rust’s type system provides many guarantees, it doesn’t prevent all bugs. We’ve created a few tools to expand the robustness of software written across the company and beyond.

Kani Rust Verifier

Kani Rust Verifier is part of a family of tools called “model checkers” to enable mathematical reasoning about software. Kani provides lightweight formal verification within Rust projects. In fact, Firecracker’s security is formally verified with Kani. You can use Kani in your own programs to increase their robustness to errors that unit and integration tests are likely to miss.

Shuttle

Shuttle is a tool for testing concurrent code that works by controlling the scheduling of each thread and scheduling those threads randomly. By controlling the scheduling, Shuttle allows us to reproduce failing tests deterministically.

CLI Utilities

Developers at Amazon have also found that writing CLIs in Rust is very worthwhile. The type system prevents many tricky runtime errors during development. CLIs written in Rust are easy to distribute, run very fast, and use very little memory.

Amazon Ion

Amazon Ion is a data format that comes with a CLI written in Rust. What’s a data format? You’ve probably seen JSON around — that’s an example of a data format. JSON is text-based, which is readable but can take up unnecessary space. It can also be unclear from receiving a file whether it contains the correct fields and data types. Unlike JSON, Ion provides both text and binary forms of its data model, to make it easy to inspect data on the fly. The CLI also enables you to validate a file against a schema.

AWS CloudFormation Guard

AWS CloudFormation Guard validates CloudFormation specifications. This can enable you to prevent mistakes entering production for people who are following an infrastructure as code methodology by including it as a pre-commit hook.

Nitro Enclaves Command Line Interface (Nitro CLI)

Nitro CLI is a tool for managing the lifecycle of Nitro Enclaves. Enclaves enable AWS customers to protect their most sensitive data by housing that data within an isolated, hardened, and highly constrained environment.

Other Utilities

Rust has also proven to be worthwhile in less prominent locations. coldsnap makes it easy to upload and EBS download snapshots from the command line, while dynein provides a CLI for Amazon DynamoDB. Flowgger can ingest, transform, and export logs from multiple sources. To provide error-bounded timestamps, ClockBound works with the chrony NTP server to enable disparate events to be ordered, independent from geographic locations of the source.

Libraries and Developer Tools

As experience is gained, it’s common for people to share what they’ve learned. By inspecting the AWS and AWS Labs Github organizations, it’s clear that the number of libraries written in Rust is growing.

s2n-quic

Cryptographic applications were another area where early experiments were taken with Rust. One of the downstream outcomes of that work is our open-source implementation of post-quantum key exchange for TLS, which is found in the s2n-quic QUIC implementation.

cargo-check-external-types

cargo-check-external-types is a Cargo plugin for Rust library authors. It helps to make sure that the library’s API stays consistent, even if a dependency changes. Essentially, it checks which types from other libraries can be part of their public API, so a change to a dependency doesn't break their library.

DCV Color Primitives

To convert between color models in different applications, a common library makes a lot of sense. The DCV Color Primitives library can convert between multiple pixel formats, while also supporting being easy to compile to multiple target architectures, including ARM (which includes Graviton family of CPUs) and WebAssembly. 


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK