1 Answer
- Newest
- Most votes
- Most comments
0
I'm new to Rust and didn't realize until now that rusoto_dynamodb
is essentially unmaintained.
Cross-compiling and static linking to musl-libc is also apparently no longer necessary, but still shows up in many blogs and tutorials.
My problem was resolved after making these changes:
- replace
rusoto_dynamodb
withaws-sdk-dynamodb
- compile on Amazon Linux 2023 with normal
gcc
- remove the
fn main() {}
pre-fetch step (this caused another issue which was masked by the initial problem)
Updated Dockerfile
:
FROM amazonlinux:2023
RUN yum install -q -y openssl-devel gcc python3 python3-pip zip make tar gzip wget
# install Rust
VOLUME /root/.cargo
ENV CARGO_HOME=/root/.cargo
ENV CARGO_TARGET_DIR=/root/.cargo/target
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Build the Application
WORKDIR /build
COPY Cargo.toml /build/
COPY src/ /build/src/
RUN cargo build --release
# Place executable into path expected by CDK Construct
RUN mkdir -p bin && cp $CARGO_TARGET_DIR/*/bootstrap bin/bootstrap
RUN strip -s bin/bootstrap
Updated Cargo.toml
:
[package]
name = "s3_cache"
version = "0.1.0"
edition = "2021"
[[bin]]
name = "bootstrap"
path = "src/main.rs"
[profile.release]
debug = true
[dependencies]
aws_lambda_events = "0.15.0"
lambda_runtime = "0.11.1"
aws-sdk-dynamodb = "1.32.0"
aws-sdk-s3 = "1.32.0"
aws-config = "1.5.1"
serde_json = "1.0.116"
serde ={ version = "1.0.116", features = ["derive"] }
flate2 = "1.0.30"
tokio = { version = "1.37.0", features = ["full"] }
tokio-util = { version = "0.7", features = ["compat"] }
futures = "0.3.17"
aws-types = "1.3.1"
csv = "1.1.6"
answered 4 months ago
Relevant content
- asked 5 years ago
- asked 2 years ago
- asked 9 months ago
- asked 3 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 9 months ago