In this example, we will demonstrate how to deploy a simple S3 Static Website using Pulumi on LocalStack. With the help of the Pulumi Node.js SDK, we will declaratively provision AWS resources & infrastructure locally on LocalStack and on the real AWS cloud.
- A valid LocalStack for AWS license. Your license provides a
LOCALSTACK_AUTH_TOKEN. - Docker
localstackCLIawslocalCLI- Pulumi
pulumilocalCLImakeandjq
export LOCALSTACK_AUTH_TOKEN=<your-auth-token>
localstack auth set-token $LOCALSTACK_AUTH_TOKEN
localstack start -d
localstack wait -t 30pulumilocal stack init website-testing
pulumilocal config set aws:region us-east-1Install the dependencies via:
yarn installTo preview and deploy the stack, run:
pulumilocal upAfter the Pulumi stack has been deployed, you should be able to check the available S3 buckets via:
awslocal s3 lsYou can access the S3 website by using the bucket name in the following format: http://<BUCKET_NAME>.s3-website.localhost.localstack.cloud:4566. Since the endpoint is configured to use localhost.localstack.cloud, no real AWS resources have been created.
This code is available under the Apache 2.0 license.