Skip to content

Secrete manager agent for Lambda is not generating bin folder

0

I am trying to setup AWS secrete manager agent as per document https://docs.aws.amazon.com/secretsmanager/latest/userguide/secrets-manager-agent.html. Following steps mentioned for Lambda. Install most of dependencies like rust and cargo but still failed to generate bin folder which acutally has integration part. I am able to run shell script mentioned in document and that able to push to extension to Lambda layer but then find out there is no bin folder. Here is error :

[extension: secrets-manager-agent-extension.sh] Received INVOKE event. [secrets-manager-agent-extension.sh] Starting Secrets Manager Agent. [secrets-manager-agent-extension.sh] Checking if the Agent is serving requests. /opt/extensions/secrets-manager-agent-extension.sh: line 28: /opt/bin/secrets-manager-agent: No such file or directory [secrets-manager-agent-extension.sh] Agent has not started yet, retrying in 100 milliseconds... [secrets-manager-agent-extension.sh] Agent has not started yet, retrying in 100 milliseconds...

While running shell script as per this link : https://docs.aws.amazon.com/secretsmanager/latest/userguide/secrets-manager-agent.html#secrets-manager-agent-install

getting this error :

CFLAGS = None cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is x86_64-linux-gnu-gcc` installed?

--- stderr

error occurred: Failed to find tool. Is x86_64-linux-gnu-gcc installed?

warning: build failed, waiting for other jobs to finish... cp: ./target/x86_64-unknown-linux-gnu/release/aws_secretsmanager_agent: No such file or directory zip warning: name not matched: bin/* `

Anyone tried so far ? what I am missing ?

1 Answer
0

It appears you're encountering issues while setting up the AWS Secrets Manager Agent for Lambda. The errors you're seeing suggest there are some missing dependencies and build problems. Let's address these issues step by step:

  1. The first error indicates that the binary file is missing in the /opt/bin directory. This is likely because the build process didn't complete successfully.

  2. The second error points to a missing compiler. The message "Is x86_64-linux-gnu-gcc installed?" suggests that you need to install the GCC compiler for the x86_64 Linux GNU platform.

To resolve these issues:

  1. Ensure you have the necessary build tools installed. On a Debian-based system, you can install them with:

    sudo apt-get update
    sudo apt-get install build-essential
    
  2. Make sure you have the correct version of Rust installed. You can install or update Rust using:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    
  3. After installing Rust, add the x86_64-unknown-linux-gnu target:

    rustup target add x86_64-unknown-linux-gnu
    
  4. Ensure you're in the correct directory when running the build commands. You should be in the root directory of the Secrets Manager Agent code package.

  5. Run the build command again:

    cargo build --release --target=x86_64-unknown-linux-gnu
    
  6. If the build is successful, the binary should be created in the target directory. You can then proceed with the rest of the steps to create the zip file and publish the layer.

If you continue to face issues, make sure you have all the necessary permissions to write to the directories you're working in. Also, double-check that you're following all the steps in the AWS documentation precisely.

Remember, building and deploying Lambda extensions requires careful attention to the build environment and target architecture. If you're developing on a different architecture than your Lambda runtime, you may need to set up cross-compilation tools.
Sources
AWS Secrets Manager Agent - AWS Secrets Manager
Use AWS Secrets Manager secrets in AWS Lambda functions - AWS Secrets Manager

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.