https://github.com/rnag/sample-rust-cdk-app
Sample Rust app using AWS CDK v2
https://github.com/rnag/sample-rust-cdk-app
Last synced: 10 months ago
JSON representation
Sample Rust app using AWS CDK v2
- Host: GitHub
- URL: https://github.com/rnag/sample-rust-cdk-app
- Owner: rnag
- Created: 2022-08-18T16:56:46.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-26T15:43:17.000Z (over 3 years ago)
- Last Synced: 2025-01-29T23:41:29.229Z (12 months ago)
- Language: Rust
- Size: 139 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sample Rust CDK App
> A [Cargo] project written in [Rust], which uses the [CDK v2] for Typescript.
[Cargo]: https://doc.rust-lang.org/cargo/
[Rust]: https://www.rust-lang.org/
[CDK v2]: https://aws.amazon.com/about-aws/whats-new/2021/12/aws-cloud-development-kit-cdk-generally-available/
You should explore the contents of this project. It demonstrates a CDK app with an instance of a stack (`SampleRustCDKAppStack`)
which contains an Amazon SQS queue that is subscribed to an Amazon SNS topic.
The `cdk.json` file tells the CDK Toolkit how to execute your app.
## Useful commands
* `npm run build` compile typescript to js
* `npm run watch` watch for changes and compile
* `npm run test` perform the jest unit tests
* `cdk deploy` deploy this stack to your default AWS account/region
* `cdk diff` compare deployed stack with current state
* `cdk synth` emits the synthesized CloudFormation template
* `cdk docs` open CDK documentation
Enjoy!
## Deployment
First things first:
1. Ensure you have the [Rust] compiler and `cargo` installed. This project has been tested with `rustc` version **1.62.1**.
2. Run `npm i` in the project directory to install all *Node.js* dependencies.
3. Follow instructions under *Getting Started* in the [rust.aws-cdk-lambda](https://www.npmjs.com/package/rust.aws-cdk-lambda) project.
Now that's out of the way, here's how you'd do a stack deployment or update to a target AWS account:
1. Set the `AWS_PROFILE` environment variable to point to the AWS account to deploy
the CDK app to.
2. Synthesize and deploy the stack with the `cdk` tool:
```shell
cdk deploy
```
> *Tip:* I find it helpful to create alias commands and add them to `~/.bash_aliases` or `~/.bashrc`, for example like `alias c="cdk deploy"`.
## Running Local Scripts
The local *example* scripts can be run, for testing or debugging purposes as needed.
For more info, check out the [README.md](./examples/README.md) under the `examples/` directory.