-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I have a Cloudformation template file that is now about 54K. I started receiving an error recently that this file was too large because I was passing it as a TemplateBody, and there is a check enforced here to mirror the real AWS limit:
| f'1 validation error detected: Value \'{request["TemplateBody"]}\' at \'templateBody\' failed to satisfy constraint: Member must have length less than or equal to 51200' |
Following the recommended advice, I tried creating an S3 bucket within localstack and then uploading the template to it, and then changed to passing in TemplateURL to the CreateStackCommand. Oddly, I got back the same complaint about TemplateBody. I also tried it using awslocal and got the same result. This made no sense to me since I was clearly only passing in the URL argument.
Further investigation into source code showed that there is a modification being made to the arguments in the case where the TemplateURL points to a local source, where it is rewritten to a local path and then loaded as a TemplateBody in the prepare_template_body function:
https://github.com/localstack/localstack/blob/master/localstack/services/cloudformation/api_utils.py
The end result is that it appears there is no way to load a template file > 51K using a local S3 bucket, and I'm actually not sure of any other way to achieve loading a larger file without requiring an external host.
Expected Behavior
Using TemplateURL as an argument to the CreateStackCommand function should have the same limit as AWS (now 1MB max I believe) regardless of whether it's a localstack-hosted S3 or a real S3 bucket.
How are you starting LocalStack?
Custom (please describe below)
Steps To Reproduce
How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)
Using TestContainers to spin up localstack programmatically as part of a component test suite.
Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
All client commands are using the AWS SDK:
const client = new S3Client({endpoint: this.S3_URL, forcePathStyle: true});
await client.send(new CreateBucketCommand({Bucket: "hmlg"}));
await client.send(new PutObjectCommand(({
Bucket: "hmlg",
Key: stackName + "-template.yml",
Body: templateString //The template read from disk
})));
const command = new CreateStackCommand({
StackName: stackName,
TemplateURL: this.S3_URL + "/hmlg/" + stackName + "-template.yml"
});
try {
await client.send(command);
} catch (error) {
console.error(error);
return false;
}
Environment
- OS: MacOS Ventura 13.2.1
- LocalStack:
LocalStack version: 1.4.1.dev
LocalStack Docker container id: 70df07093834
LocalStack build date: 2023-03-02
LocalStack build git hash: b81ef493Anything else?
No response