aws-sdk-rust: secret store on lambda produces a variety of surprising errors but no valid responses
Describe the bug
I have the params+secrets layer attached v11. I have been repeatedly trying as is my bad habit, and so far neither of 2 methods have worked to retrieve the secret. I have followed the secretmanager example which “works on my machine” but on lambda I get the following surprising errors (w/ debug and full tracing on for smithy, afaict):
1st method: SDK:
2023-09-28T14:02:43.737563Z INFO lazy_load_credentials: aws_credential_types::cache::lazy_caching: credentials cache miss occurred; added new AWS credentials (took Ok(23.901µs))
-- | --
2023-09-28T14:02:43.737603Z INFO lazy_load_credentials: aws_credential_types::cache::lazy_caching: close time.busy=55.3µs time.idle=2.36µs
EXTENSION Name: AWSParametersAndSecretsLambdaExtension State: Ready Events: [INVOKE, SHUTDOWN]
As you can see nothing happens, the debug! trace from inside of the lazy_caching doesn’t seem to fire off either, but no credentials are returned.
2nd method: http://localhost:2773/secretsmanager/get...
This one is more surprising to me because I haven’t seen anyone getting this error.
Ok(Response { url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(2773), path: "/secretsmanager/get", query: Some("secretId={tried everything from full arn to just name}"), fragment: None }, status: 400, headers: {"content-type": "text/plain", "x-amzn-errortype": "BadRequestException", "date": "Thu, 28 Sep 2023 17:56:29 GMT", "content-length": "39"} })
At the end of my rope as I got in a loop of “just one more thing” over and over.
Expected Behavior
I wanted to get a working response that I could decode into JSON, instead I get timeouts or the BadRequest error
let v: serde_json::Value = serde_json::from_str(resp.secret_string().unwrap()).unwrap();
println!("Value: {}", v["password"]);
^ this code (with my aws creds local) works fine.
Current Behavior
BadRequestException 400 with plain http to localhost 2773.
[edit] SDK secretmanager errors like this (I had to up the exec time to get this): Err(DispatchFailure(DispatchFailure { source: ConnectorError { kind: Timeout, source: hyper::Error(Connect, HttpTimeoutError { kind: "HTTP connect", duration: 3.1s }), connection: Unknown } }))
Reproduction Steps
- Create lambda function (excitingly easy)
- Put secret in secret manager.
- Add roles to allow access to lambda runner role. Allow: secretsmanager:GetSecretValue
- Allow: secretsmanager:DescribeSecret
- Add a kms role for good luck: Allow: kms:Decrypt
- Add secrets layer to lambda function
- Attempt to do 1 http request from a rust lambda fn to get the secret. (hardest thing I’ve ever attempted to do in AWS apparently)
Possible Solution
Permissions? Bad urls in the docs? Broken SDK function, that works on my (ARM) machine but not on ARM lambdas? Some terrifying feature issue?
It is a truly next level problem where I have to write an issue. I’m praying this is just that I didn’t allow my lambda to read a secret in some way and it’s just a documentation failure, otherwise I honestly can’t understand how this code could fail so opaquely. Thanks for reading at least.
Additional Information/Context
I went through hoping this would just work, but somewhere around hour 3 I realized wait a second, this really should just work or at least throw an error that someone can search for. This is on arm64, which I hope isn’t the issue. I’m hoping this is a permissions issue that isn’t mentioned in the documentation, but I know that (a) I have an AWS_SESSION_TOKEN (b) that 2773 on localhost is open to the running function © that I’ve tried 3% of the possible ways of getting the json to return (d) I have not tried POST-ing (d) reaching out to the externally hosted secrets managers doesn’t seem to work either, but the exact URLs for individual requests are not given in the documentation at this time.
Version
├── aws-config v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ ├── aws-credential-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ ├── aws-smithy-async v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ ├── aws-smithy-runtime-api v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ │ ├── aws-smithy-async v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ │ │ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ │ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ ├── aws-credential-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ │ ├── aws-credential-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-async v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-client v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ │ │ ├── aws-smithy-async v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ │ ├── aws-smithy-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ │ ├── aws-smithy-http-tower v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ │ │ │ ├── aws-smithy-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ │ │ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ │ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-sdk-sso v0.0.0-local (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ ├── aws-credential-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-runtime v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ │ ├── aws-credential-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-sigv4 v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ │ │ ├── aws-credential-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ │ ├── aws-smithy-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ │ ├── aws-smithy-runtime-api v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-async v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-runtime-api v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-async v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-client v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-json v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ │ └── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-runtime v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ │ ├── aws-smithy-async v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-client v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-runtime-api v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ │ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-runtime-api v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-sdk-sts v0.0.0-local (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ ├── aws-credential-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-runtime v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-async v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-client v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-json v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-query v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ │ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-runtime v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-runtime-api v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ │ ├── aws-smithy-xml v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ │ ├── aws-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-async v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-client v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-http-tower v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-json v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
├── aws-sdk-secretsmanager v0.0.0-local (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535)
│ ├── aws-credential-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-runtime v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-async v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-client v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-http v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-json v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-runtime v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-runtime-api v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-smithy-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
│ ├── aws-types v0.56.1 (https://github.com/awslabs/aws-sdk-rust?branch=next#8108b535) (*)
Environment details (OS name and version, etc.)
arm64
Logs
The code that made this log is trying both the plain http request and the SDK.
INIT_START Runtime Version: provided:al2.v23 Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:febdf188505e3a7c9cad819ea0b63328df31e9eefeb8eed817c3137edf3a93b4
--
| 2023-09-28T13:56:28.932-04:00 | [AWS Parameters and Secrets Lambda Extension] 2023/09/28 17:56:28 PARAMETERS_SECRETS_EXTENSION_LOG_LEVEL is debug. Log level set to debug.
| 2023-09-28T13:56:28.933-04:00 | [AWS Parameters and Secrets Lambda Extension] 2023/09/28 17:56:28 DEBUG PARAMETERS_SECRETS_EXTENSION_CACHE_ENABLED is not present. Cache is enabled by default.
| 2023-09-28T13:56:28.933-04:00 | [AWS Parameters and Secrets Lambda Extension] 2023/09/28 17:56:28 DEBUG PARAMETERS_SECRETS_EXTENSION_CACHE_SIZE is not present. Using default cache size: 1000 objects.
| 2023-09-28T13:56:28.933-04:00 | [AWS Parameters and Secrets Lambda Extension] 2023/09/28 17:56:28 DEBUG SECRETS_MANAGER_TTL is not present. Setting default time-to-live: 5m0s.
| 2023-09-28T13:56:28.933-04:00 | [AWS Parameters and Secrets Lambda Extension] 2023/09/28 17:56:28 DEBUG SSM_PARAMETER_STORE_TTL is not present. Setting default time-to-live: 5m0s.
| 2023-09-28T13:56:28.933-04:00 | [AWS Parameters and Secrets Lambda Extension] 2023/09/28 17:56:28 DEBUG SECRETS_MANAGER_TIMEOUT_MILLIS is not present. Setting default timeout: 0s.
| 2023-09-28T13:56:28.933-04:00 | [AWS Parameters and Secrets Lambda Extension] 2023/09/28 17:56:28 DEBUG SSM_PARAMETER_STORE_TIMEOUT_MILLIS is not present. Setting default timeout: 0s.
| 2023-09-28T13:56:28.933-04:00 | [AWS Parameters and Secrets Lambda Extension] 2023/09/28 17:56:28 DEBUG PARAMETERS_SECRETS_EXTENSION_MAX_CONNECTIONS is not present. Setting default value: 3.
| 2023-09-28T13:56:28.933-04:00 | [AWS Parameters and Secrets Lambda Extension] 2023/09/28 17:56:28 DEBUG PARAMETERS_SECRETS_EXTENSION_HTTP_PORT is not present. Setting default port: 2773.
| 2023-09-28T13:56:28.935-04:00 | [AWS Parameters and Secrets Lambda Extension] 2023/09/28 17:56:28 INFO Systems Manager Parameter Store and Secrets Manager Lambda Extension 1.0.143
| 2023-09-28T13:56:28.935-04:00 | [AWS Parameters and Secrets Lambda Extension] 2023/09/28 17:56:28 DEBUG Creating a new cache with size 1000
| 2023-09-28T13:56:28.935-04:00 | [AWS Parameters and Secrets Lambda Extension] 2023/09/28 17:56:28 INFO Serving on port 2773
| 2023-09-28T13:56:28.978-04:00 | not a problem, no .env file found, ok if running in container with docker handling external .env -> Container Environment
| 2023-09-28T13:56:29.048-04:00Copyresponse or error: Ok(Response { url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(2773), path: "/secretsmanager/get", query: Some("secretId=rds!db-03212a4c-03fc-40f1-8b2d-0658dd9ac02a&versionStage=AWSCURRENT"), fragment: None }, status: 400, headers: {"content-type": "text/plain", "x-amzn-errortype": "BadRequestException", "date": "Thu, 28 Sep 2023 17:56:29 GMT", "content-length": "39"} }) | response or error: Ok(Response { url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(2773), path: "/secretsmanager/get", query: Some("secretId=rds!db-03212a4c-03fc-40f1-8b2d-0658dd9ac02a&versionStage=AWSCURRENT"), fragment: None }, status: 400, headers: {"content-type": "text/plain", "x-amzn-errortype": "BadRequestException", "date": "Thu, 28 Sep 2023 17:56:29 GMT", "content-length": "39"} })
| 2023-09-28T13:56:34.048-04:00 | one more time with just the id!
| 2023-09-28T13:56:34.078-04:00 | response or error: Response { url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(2773), path: "/secretsmanager/get", query: Some("secretId=thisissomebull{I put swearwords in here because I'd really hit my limit and just wanted some error that made sense}"), fragment: None }, status: 400, headers: {"content-type": "text/plain", "x-amzn-errortype": "BadRequestException", "date": "Thu, 28 Sep 2023 17:56:34 GMT", "content-length": "39"} }
| 2023-09-28T13:56:34.078-04:00 | reqwest style:
| 2023-09-28T13:56:34.078-04:00 | [server/src/main.rs:166] &on_aws = Ok(
| 2023-09-28T13:56:34.078-04:00 | "oops",
| 2023-09-28T13:56:34.078-04:00 | )
| 2023-09-28T13:56:34.078-04:00 | sdk style:
| 2023-09-28T13:56:34.078-04:00 | getting shared_config
| 2023-09-28T13:56:34.093-04:00 | 2023-09-28T17:56:34.093425Z INFO load_region{provider=EnvironmentVariableRegionProvider { env: Env(Real) }}: aws_config::meta::region: new
| 2023-09-28T13:56:34.093-04:00 | 2023-09-28T17:56:34.093462Z INFO load_region{provider=EnvironmentVariableRegionProvider { env: Env(Real) }}: aws_config::meta::region: enter
| 2023-09-28T13:56:34.093-04:00 | 2023-09-28T17:56:34.093468Z INFO load_region{provider=EnvironmentVariableRegionProvider { env: Env(Real) }}: aws_config::meta::region: exit
| 2023-09-28T13:56:34.093-04:00 | 2023-09-28T17:56:34.093472Z INFO load_region{provider=EnvironmentVariableRegionProvider { env: Env(Real) }}: aws_config::meta::region: close time.busy=6.15µs time.idle=46.5µs
| 2023-09-28T13:56:34.123-04:00 | getting client
| 2023-09-28T13:56:34.128-04:00 | got the client but who cares
| 2023-09-28T13:56:34.128-04:00 | looooop
| 2023-09-28T13:56:34.132-04:00 | 2023-09-28T17:56:34.132864Z INFO lazy_load_credentials: aws_credential_types::cache::lazy_caching: new
| 2023-09-28T13:56:34.132-04:00 | 2023-09-28T17:56:34.132898Z INFO lazy_load_credentials: aws_credential_types::cache::lazy_caching: enter
| 2023-09-28T13:56:34.132-04:00 | 2023-09-28T17:56:34.132918Z INFO lazy_load_credentials: aws_credential_types::cache::lazy_caching: credentials cache miss occurred; added new AWS credentials (took Ok(64.147µs))
| 2023-09-28T13:56:34.132-04:00 | 2023-09-28T17:56:34.132924Z INFO lazy_load_credentials: aws_credential_types::cache::lazy_caching: exit
| 2023-09-28T13:56:34.132-04:00 | 2023-09-28T17:56:34.132927Z INFO lazy_load_credentials: aws_credential_types::cache::lazy_caching: close time.busy=26.7µs time.idle=39.7µs
| 2023-09-28T13:56:38.891-04:00CopyEXTENSION Name: AWSParametersAndSecretsLambdaExtension State: Ready Events: [INVOKE, SHUTDOWN] | EXTENSION Name: AWSParametersAndSecretsLambdaExtension State: Ready Events: [INVOKE, SHUTDOWN]
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 18 (5 by maintainers)
Glad to hear you figured it out!
My nightmare is over. I can point to exactly where I went wrong and what the fix was. The fix was this comment by Ribeiro: https://stackoverflow.com/questions/62274069/aws-lambda-access-secrets-manager-from-within-vpc#comment121571222_62274140
My mistake was from this post from amazon: https://aws.amazon.com/blogs/security/how-to-connect-to-aws-secrets-manager-service-within-a-virtual-private-cloud/ < Step 6 is … not enough if you don’t have a ‘wide open’ security group and I think it blocked all of this from working regardless of what the code was doing by putting in any old security group for “the security group […] created earlier”.
Still not sure if this was also preventing the Layer from communicating to the secrets manager (I assume it was) but otherwise if you don’t have your groups set up neatly like that comment on stack overflow (allow 443 into the secrets vpc endpoint from the lambda subnets with one SG on the secrets endpoint and allow the lambda to speak outbound on 443 to the secrets manager SG you just created or the subnet the secrets manager is on)
Sorry for my frustration, It was rather simple underneath the errors. Timeouts are disallowed routes or nonexistent routes, nothing more or less, sadly there’s nothing screaming at you saying “don’t take a 5 year old blog post at its word”. Whoops. Thanks for all your help. Once I get this going I may experiment with the layer vs vpc endpoint setup.
Your message https://github.com/awslabs/aws-sdk-rust/issues/905#issuecomment-1740074797 shows a log line where it is in fact setting the token properly (see
Authorizationheader). It’s possible that with the URL with a port in it we aren’t signing properly though?Since you’re using reqwest, you can enable trace level logging for the hyper crate to get the exact thing it sends over the socket. That might be helpful in diagnosing the issue.
I’m sorry I can’t be more helpful here since I’m not so familiar with this Lambda feature. However, I can say for certain that we don’t have any built-in support for accessing these secrets on localhost in Lambda in the SDK.
It sounds to me like there’s a configuration issue happening somewhere. It’s almost as if nothing is actually listening on localhost:2773, and hence, it never connects.