setup-localstack icon indicating copy to clipboard operation
setup-localstack copied to clipboard

Speeding up the runtime

Open sondrelg opened this issue 9 months ago • 2 comments

Hi!

Thanks for creating this project. Localstack has been very helpful in testing SQS/SNS locally! I'm currently on the non-pro version.

I just have one issue: in CI it takes over a minute to set up localstack for testing. Is there any way to speed this up? Here's a dump:

localstack/[email protected]
  with:
    image-tag: latest
    install-awslocal: true
    use-pro: false
    skip-startup: false
    skip-wait: false
    skip-ephemeral-stop: true
    state-backend: cloud-pods
    lifetime: 30

Would it, e.g., save time to skip installing the awslocal-cli and instead use the aws-cli with --endpoint localhost:4566? Are there other tricks like this you know of?

sondrelg avatar Apr 01 '25 04:04 sondrelg

By replacing the action with:

- run: docker pull localstack/localstack &
...
- run: |
    docker run -d -p 4566:4566 localstack/localstack -e "SERVICES=sns,sqs"
    aws sns create-topic --name "foo"
    aws sqs create-queue --queue-name "bar"
  env:
    AWS_DEFAULT_REGION: us-east-1
    AWS_ACCESS_KEY_ID: test
    AWS_SECRET_ACCESS_KEY: test
    AWS_ENDPOINT_URL: http://localhost:4566

I'm able to get the runtime down to 5 + 15 seconds - down from ~1 minute

sondrelg avatar Apr 01 '25 07:04 sondrelg

An easy win for speed ups in this action would be to use uv instead of pip. Though your alternative approach I've found is actually quite a bit simpler in general.

brendan-morin avatar Aug 02 '25 21:08 brendan-morin