I am able to create and test AWS locally using localstack. So, I'm wondering if there are any use cases out there where I can reference how to add localstack in ci/cd and run your test cases? any pointer showing the sample would be appreciated.
I am able to create and test AWS locally using localstack. So, I'm wondering if there are any use cases out there where I can reference how to add localstack in ci/cd and run your test cases? any pointer showing the sample would be appreciated.
With a bit of work I managed to get LocalStack working correctly in my CI.
A minimal example using GitHub Actions:
name: ci
on: push
jobs:
localstack:
runs-on: ubuntu-latest
services:
localstack:
image: localstack/localstack:latest
env:
SERVICES: cloudformation,iam,sts,ssm,s3,cloudwatch,cloudwatch-logs,lambda,dynamodb,apigateway
DEFAULT_REGION: eu-west-1
AWS_ACCESS_KEY_ID: localkey
AWS_SECRET_ACCESS_KEY: localsecret
ports:
- 4566:4566
- 4571:4571
steps:
- uses: actions/checkout@v2
- name: Deploying to LocalStack
run: |
# Your deployment code...
env:
DEFAULT_REGION: eu-west-1
AWS_ACCOUNT_ID: "000000000000"
AWS_ACCESS_KEY_ID: localkey
AWS_SECRET_ACCESS_KEY: localsecret
You can tweak the SERVICES and DEFAULT_REGION a bit. The Deploying to LocalStack step contains the environment variables necessary for the deployment to go smoothly.
You would fill in the rest of the steps here depending on what you are doing in your CI.
You can checkout https://help.github.com/en/articles/workflow-syntax-for-github-actions for some more information on the syntax in the GitHub Actions workflow files.