diff --git a/examples/README.md b/examples/README.md index 20665522..6d40f92d 100644 --- a/examples/README.md +++ b/examples/README.md @@ -3,6 +3,44 @@ All example commands should be executed in the `examples/` directory in an up-to-date checkout of the [dagger repository](https://github.com/dagger/dagger). +## Deploy a static page to S3 + +This example shows how to generate a simple HTML page and serve it from an S3 bucket. + +Components: + +- [Amazon S3](https://aws.amazon.com/s3/) for hosting + +1. Change the current directory to the example deployment plan and create a new deployment + +```sh +cd ./simple-s3 +dagger new +``` + +2. Configure your AWS credentials + +```sh +dagger input text awsConfig.accessKey MY_AWS_ACCESS_KEY +dagger input text awsConfig.secretKey MY_AWS_SECRET_KEY +``` + +3. Deploy! + +```sh +dagger up +``` + +4. Change a variable to alter the content + +In this example config, the HTML content is created from a variable `name` that has a default value, here is a simple +way to change it without changing the code: + +```sh +dagger input text name "someone else!" +dagger up +``` + ## Deploy a simple React application This example shows how to deploy an example React Application. [Read the deployment plan](https://github.com/dagger/dagger/tree/main/examples/react) @@ -120,9 +158,6 @@ dagger new ```sh dagger input text awsConfig.accessKey MY_AWS_ACCESS_KEY -``` - -```sh dagger input text awsConfig.secretKey MY_AWS_SECRET_KEY ``` @@ -165,9 +200,6 @@ dagger new ```sh dagger input text awsConfig.accessKey MY_AWS_ACCESS_KEY -``` - -```sh dagger input text awsConfig.secretKey MY_AWS_SECRET_KEY ``` @@ -217,9 +249,6 @@ dagger new ```sh dagger input text awsConfig.accessKey MY_AWS_ACCESS_KEY -``` - -```sh dagger input text awsConfig.secretKey MY_AWS_SECRET_KEY ``` diff --git a/examples/simple-s3/main.cue b/examples/simple-s3/main.cue new file mode 100644 index 00000000..f93ff379 --- /dev/null +++ b/examples/simple-s3/main.cue @@ -0,0 +1,33 @@ +package main + +import ( + "dagger.io/aws" + "dagger.io/aws/s3" +) + +// AWS Config for credentials and default region +awsConfig: aws.#Config & { + region: *"us-east-1" | string +} + +// Name of the S3 bucket to use +bucket: *"hello-s3.infralabs.io" | string + +name: string | *"world" + +page: """ + + +