Hello,
I am seeking help with a legacy application that has been working well in production. The backend is built using AWS CDK, and the frontend is an AWS Amplify application (client code only).
I have successfully deployed my CDK code to LocalStack. However, I need to redirect AWS Amplify to use this new LocalStack instance.
I can log in via Cognito by overriding the endpoint parameter in the auth configuration. However, any attempt to override the S3 endpoint fails.
I have looked into amplify-localstack, but this seems to be for deploying Amplify backend resources and does not clearly explain how to use it for my scenario.
{
API: {
endpoints: [
{
custom_header: async () => {
return {
Authorization: `${(await Auth.currentSession())
.getAccessToken()
.getJwtToken()}`,
};
},
endpoint: "http://localhost:4566/restapis/ega9w41v7i/dev",
name: "ormAPI",
},
],
},
Auth: {
authenticationFlowType: "USER_SRP_AUTH",
endpoint: "http://localhost:4566", // Ensure this points to LocalStack
identityPoolId: "ap-southeast-2:c87d86a1-0d0f-40ea-abc1-f4d437f075cb",
region: "ap-southeast-2",
userPoolId: "ap-southeast-2_eeaab13dc3824e8ebfe6206ec5fa9728",
userPoolWebClientId: "cmx792rwg9pdup60pb4i9me2yf",
},
Storage: {
AWSS3: {
bucket: "storagestack-dev-databucketd8691f4e-7096f617",
endpoint: "http://localhost:4566",
region: "ap-southeast-2",
s3ForcePathStyle: true, // Suggested by ChatGPT
},
},
endpoint: "http://localhost:4566",
};
}
Does anyone have any advice or examples on how to properly configure Amplify to use LocalStack for S3?
Thank you!

