Skip to content

Instantly share code, notes, and snippets.

@skorfmann
Created October 24, 2023 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skorfmann/2370ba39cd8680435253d2126051fc6e to your computer and use it in GitHub Desktop.
Save skorfmann/2370ba39cd8680435253d2126051fc6e to your computer and use it in GitHub Desktop.
/**
* Post-synthesis function to configure AWS provider for LocalStack
*/
exports.postSynth = function(config) {
const endpoint = "http://localhost:4566";
const services = [
"apigateway", "apigatewayv2", "cloudformation", "cloudwatch", "dynamodb", "ec2", "es",
"elasticache", "firehose", "iam", "kinesis", "lambda", "rds", "redshift", "route53",
"secretsmanager", "ses", "sns", "sqs", "ssm", "stepfunctions", "sts"
];
let endpoints = {};
services.forEach(service => {
endpoints[service] = endpoint;
});
endpoints["s3"] = "http://s3.localhost.localstack.cloud:4566";
config.provider.aws = {
access_key: "test",
secret_key: "test",
region: "us-east-1",
s3_use_path_style: false,
skip_credentials_validation: true,
skip_metadata_api_check: true,
skip_requesting_account_id: true,
endpoints
}
return config;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment