The AWS Access Key Id you provided does not exist in our records #10756
Labels
area: configuration
Configuring LocalStack
status: backlog
Triaged but not yet being worked on
type: bug
Bug report
Is there an existing issue for this?
Current Behavior
Here is a docker-compose.yaml
`version: "3.8"
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
image: localstack/localstack
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
environment:
# LocalStack configuration: https://docs.localstack.cloud/references/configuration/
- DEBUG=${DEBUG:-0}
# - AWS_REGION=eu-west-2
- AWS_ACCESS_KEY_ID=1
- AWS_SECRET_ACCESS_KEY=1
volumes:
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"`
I deploy lambda to localstack and try to get s3 object in java code but got an error
`
public class App implements RequestHandler<S3Event, String> {
Gson gson = new GsonBuilder().setPrettyPrinting()
.excludeFieldsWithoutExposeAnnotation()
.create();
Here is log
aws lambda invoke --function-name s3-Storage-14087538 --cli-binary-format raw-in-base64-out --payload file://s3.json --profile st out --log-type Tail --query 'LogResult' --output text --cli-binary-format raw-in-base64-out | base64 --decode START RequestId: 3c2fbbac-2d59-438b-b932-9ba226f4f9bd Version: $LATEST *************************************************************************************** Client: {}*************************************************************************************** ENVIRONMENT VARIABLES: { "PATH": "/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin", "_AWS_XRAY_DAEMON_ADDRESS": "127.0.0.1", "LAMBDA_TASK_ROOT": "/var/task", "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": "512", "TZ": ":UTC", "AWS_SECRET_ACCESS_KEY": "1", "AWS_EXECUTION_ENV": "AWS_Lambda_java17", "AWS_DEFAULT_REGION": "us-east-1", "AWS_LAMBDA_LOG_GROUP_NAME": "/aws/lambda/s3-Storage-14087538", "_HANDLER": "vsvdev.App::handleRequest", "LANG": "en_US.UTF-8", "LAMBDA_RUNTIME_DIR": "/var/runtime", "AWS_SESSION_TOKEN": "FQoGZXIvYXdzEBYaDmCnYve+fO7VCvI86oywQLDi8P19FubBKwdGD+LaJ2EbpXs1htIHT6UC5ZSIX+qgyVjEciTnfrcqNh5gZrJLVcK51RXzS2z0gVoAUwi0HaRIDLUeU1N8zg8Bx3DiWxgqnlLhpAxP8DsUjaBDZiMztdzPM7g2JGOyvctcQ6Ii5aANYzjPDVYToAkILcMI6/Z++igA++QXBZDeirhZsTJn4NRpJz2md7l4W4PcS4gCwdC0dkV+eHr2+frGHxH0IkHwMdKk8OvtgljKciAeR2wG7Mjezk+oVgPqAwXjVwBSB+9C09zIrEU2gD6PGP+3fbIPMBwEwDGkvbrc+ISozSk\u003d", "AWS_ACCESS_KEY_ID": "1", "LD_LIBRARY_PATH": "/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib", "AWS_LAMBDA_RUNTIME_API": "127.0.0.1:9001", "AWS_REGION": "us-east-1", "AWS_LAMBDA_FUNCTION_TIMEOUT": "3", "AWS_ENDPOINT_URL": "http://localhost:4566", "AWS_LAMBDA_LOG_STREAM_NAME": "2024/05/01/[$LATEST]772baeb523efe5029239d8331c7eb3f3", "AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand", "SOURCE_BUCKET": "sourceconfigbckt", "AWS_XRAY_DAEMON_ADDRESS": "127.0.0.1:2000", "_AWS_XRAY_DAEMON_PORT": "2000", "AWS_XRAY_CONTEXT_MISSING": "LOG_ERROR", "EDGE_PORT": "4566", "AWS_CONTAINER_AUTHORIZATION_TOKEN": "36b2c8fb-47af-4087-9717-fb18ae67a630", "AWS_LAMBDA_FUNCTION_VERSION": "$LATEST", "LOCALSTACK_HOSTNAME": "172.18.0.2", "AWS_LAMBDA_FUNCTION_NAME": "s3-Storage-14087538", "AWS_CONTAINER_CREDENTIALS_FULL_URI": "http://127.0.0.1:9001/2021-04-23/credentials" }bucket name: "vsvdevsource"file name: "test2.txt"Exception herecom.amazonaws.services.s3.model.AmazonS3Exception: The AWS Access Key Id you provided does not exist in our records. (Service: Amazon S3; Status Code: 403; Error Code: InvalidAccessKeyId; Request ID: E9Q5T9116R8GHMWQ; S3 Extended Request ID: lsk3gtK5tFm4zZMqX6+8kw/jAS1vjAd1J9GDNurrmYmq/sb+x3hoV1cCXdEDwFisQsICMRBlDN8=; Proxy: null), S3 Extended Request ID: lsk3gtK5tFm4zZMqX6+8kw/jAS1vjAd1J9GDNurrmYmq/sb+x3hoV1cCXdEDwFisQsICMRBlDN8= Error: Input is empty Input is empty: java.lang.RuntimeException
I also tried use it without endpoint
`String accesskey = System.getenv("AWS_ACCESS_KEY_ID");
String secret = System.getenv("AWS_SECRET_ACCESS_KEY");
ClientConfiguration config = new ClientConfiguration();
config.setProtocol(Protocol.HTTP);
s3 = new AmazonS3Client(new BasicAWSCredentials(accesskey, secret), config);
S3ClientOptions options = new S3ClientOptions();
options.setPathStyleAccess(true);
And also my deployed function
{ "Functions": [ { "FunctionName": "s3-Storage-14087538", "FunctionArn": "arn:aws:lambda:us-east-1:000000000000:function:s3-Storage-14087538", "Runtime": "java17", "Role": "arn:aws:iam::000000000000:role/s3-StorageRole-d5ff3508", "Handler": "vsvdev.App::handleRequest", "CodeSize": 7055211, "Description": "", "Timeout": 3, "MemorySize": 512, "LastModified": "2024-05-01T09:28:27.151207+0000", "CodeSha256": "Pyt4/ojnmRJTO344BMUh+lOOlbLBh2ZmEKqZVxdHHO0=", "Version": "$LATEST", "Environment": { "Variables": { "SOURCE_BUCKET": "sourceconfigbckt", "AWS_ACCESS_KEY_ID": "1", "AWS_SECRET_ACCESS_KEY": "1", "AWS_ENDPOINT_URL": "http://localhost:4566" } }, "TracingConfig": { "Mode": "PassThrough" }, "RevisionId": "0a87b6ac-fa4e-4d9d-aa92-f11d2e2ff437", "PackageType": "Zip", "Architectures": [
Expected Behavior
works without errors
How are you starting LocalStack?
With a docker-compose file
Steps To Reproduce
How are you starting localstack (e.g.,
bin/localstack
command, arguments, ordocker-compose.yml
)run localstack: docker compose up
create lambda which read from s3 based on event.
put object to s3
Triger function
Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
sam build
sam deploy --guided --profile st
aws lambda list-function --profile st
aws s3 ls --profile st
aws s3api put-object --bucket vsvdevsource --key test2.txt --body test2.txt --profile st
aws s3api list-objects --bucket vsvdevsource --profile st
aws s3api list-objects --bucket vsvdevdestination --profile st
aws s3api create-bucket --bucket sample --profile st
sam local generate-event s3 put --bucket vsvdevsource > events/s3.json
aws lambda invoke --invocation-type Event --function-name Storage --cli-binary-format raw-in-base64-out --payload file://s3.json --profile st out.txt
aws lambda list-functions --profile st
aws lambda invoke --function-name s3-Storage-14087538 --cli-binary-format raw-in-base64-out --payload file://s3.json --profile st out --log-type Tail --query 'LogResult' --output text --cli-binary-format raw-in-base64-out | base64 --decode
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: