Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving s3 as a basic quickstart to model AWS resources #509

Merged
merged 48 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
852614c
Moving s3 as a quickstart
Reshrahim Mar 13, 2023
8d1f706
Merge branch 'edge' into reshma/awsquickstarts
Reshrahim Mar 21, 2023
bfccc52
Adding logos and tags
Reshrahim Mar 22, 2023
2291d80
Updates to content
Reshrahim Mar 22, 2023
01a6b43
Update docs/content/getting-started/quickstarts/quickstart-aws-s3/_in…
Reshrahim Mar 24, 2023
3c6c9e2
Update docs/content/getting-started/quickstarts/quickstart-aws-s3/_in…
Reshrahim Mar 24, 2023
47e1b99
Merge branch 'edge' into reshma/awsquickstarts
Reshrahim Mar 24, 2023
8e8737e
Address comments
Reshrahim Mar 24, 2023
9c2e11c
Update docs/content/getting-started/quickstarts/quickstart-aws-s3/_in…
Reshrahim Mar 24, 2023
67bf5a4
Update docs/content/getting-started/quickstarts/quickstart-aws-s3/_in…
Reshrahim Mar 24, 2023
e646810
Address feedback
Reshrahim Mar 24, 2023
61cb8d0
Merge branch 'reshma/awsquickstarts' of https://github.com/project-ra…
Reshrahim Mar 24, 2023
cc9cb38
Update s3 bucket
Reshrahim Mar 27, 2023
d518cda
Merge branch 'edge' into reshma/awsquickstarts
Reshrahim Apr 3, 2023
86c3187
Remove tags and make aws recipes quickstart hidden
Reshrahim Apr 3, 2023
f5decbd
Merge branch 'reshma/awsquickstarts' of https://github.com/project-ra…
Reshrahim Apr 3, 2023
ba41be4
Resolve merge conflicts
Reshrahim May 1, 2023
79a7eb4
Update bucket name as parameter
Reshrahim May 1, 2023
5aeb5be
Add pointer to creating a different IAM role
Reshrahim May 1, 2023
b5df84e
Merge branch 'edge' into reshma/awsquickstarts
Reshrahim May 1, 2023
770e7c8
Update docs/content/getting-started/quickstarts/quickstart-aws-s3/_in…
Reshrahim May 1, 2023
e0d41fc
Update docs/content/getting-started/quickstarts/quickstart-aws-s3/_in…
Reshrahim May 1, 2023
fd67c46
Update docs/content/getting-started/quickstarts/quickstart-aws-s3/_in…
Reshrahim May 1, 2023
bdf3d80
Update docs/content/getting-started/quickstarts/quickstart-aws-s3/_in…
Reshrahim May 1, 2023
0e98d01
Address comments
Reshrahim May 8, 2023
aeff1f3
Merge branch 'edge' into reshma/awsquickstarts
Reshrahim May 8, 2023
0d082bc
Update app digram
Reshrahim May 9, 2023
330699d
Address comments
Reshrahim May 9, 2023
55088cd
Address comments
Reshrahim May 9, 2023
c946717
Address feedback
Reshrahim May 9, 2023
c740c56
Merge branch 'edge' into reshma/awsquickstarts
Reshrahim May 15, 2023
acdfa43
Update docs/content/getting-started/quickstarts/quickstart-aws-s3/_in…
Reshrahim May 15, 2023
f743828
Update docs/content/getting-started/quickstarts/quickstart-aws-s3/_in…
Reshrahim May 15, 2023
5050a9b
Merge branch 'edge' into reshma/awsquickstarts
AaronCrawfis May 15, 2023
2131db6
Update docs/content/getting-started/quickstarts/quickstart-aws-s3/sni…
Reshrahim Jun 5, 2023
c000f5a
Resolve conflicts
Reshrahim Jun 6, 2023
6b70518
address feedback
Reshrahim Jun 6, 2023
d89ed7d
Merge branch 'edge' into reshma/awsquickstarts
Reshrahim Jun 7, 2023
38bd8d5
Trigger Build
Reshrahim Jun 8, 2023
fe06f75
Address feedback
Reshrahim Jun 12, 2023
3bb1be5
Merge branch 'edge' into reshma/awsquickstarts
Reshrahim Jun 27, 2023
4e5d1bf
Address feedback
Reshrahim Jun 27, 2023
734eb61
Fix spelling
Reshrahim Jun 27, 2023
94d011c
update ref
Reshrahim Jun 27, 2023
0b1d5b6
Address comments
Reshrahim Jun 28, 2023
5804292
Fix bicep code
Reshrahim Jun 28, 2023
73b052a
Add further reading section
Reshrahim Jun 28, 2023
0083307
Merge branch 'edge' into reshma/awsquickstarts
willtsai Jul 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ enableGitInfo = true
# Taxonomies
[taxonomies]
category = "categories"
tag = "tags"

Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

# Top Nav Bar
[[menu.main]]
Expand Down
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
type: docs
title: "Quickstart: Deploy AWS resources"
linkTitle: "Deploy AWS resources"
title: "Quickstart: Deploy using AWS recipes"
linkTitle: "Deploy using AWS recipes"
description: "Learn about how to setup an AWS cloud provider and deploy an AWS MemoryDB for Redis with Radius"
weight: 500
slug: "aws"
---

This quickstart will teach you:
Expand All @@ -21,7 +20,6 @@ This quickstart will teach you:
- [eksctl CLI](https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html)

Reshrahim marked this conversation as resolved.
Show resolved Hide resolved
## Step 1: Create an EKS cluster

Create an EKS cluster by using the `eksctl` CLI. This command will create a cluster in the `us-west-2` region, as well as a VPC and the Subnets, Security Groups, and IAM Roles required for the cluster.
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

```bash
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
type: docs
title: "Quickstart: Deploy AWS resources"
linkTitle: "Deploy AWS resources"
description: "Learn about how to add AWS resources to your application and deploy them with Radius"
---

This quickstart will show you:

* How to model an AWS S3 resource in Bicep
* How to use a sample application to interact with AWS S3
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

## Prerequisites
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

- Make sure you have an [AWS account](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account) and an [IAM user](https://docs.aws.amazon.com/IAM/latest/UserGuide/getting-started_create-admin-group.html)
- [Create an IAM AWS access key](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) and copy the AWS Access Key ID and the AWS Secret Access Key to a secure location for use later. If you have already created an Access Key pair, you can
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved
- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
- Configure your CLI with [`aws configure`](https://docs.aws.amazon.com/cli/latest/reference/configure/index.html), specifying your configuration values
willtsai marked this conversation as resolved.
Show resolved Hide resolved
- [eksctl CLI](https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html)
- [kubectl CLI](https://kubernetes.io/docs/tasks/tools/install-kubectl/)

## Step 1: Create an EKS Cluster
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

Create an EKS cluster by using the `eksctl` CLI.

```bash
eksctl create cluster --name <my-cluster> --region=<my-region>
```
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

## Step 2: Create a Radius environment with the AWS cloud provider

Create a [Radius environment]({{< ref environments >}}) where you will deploy your application.


1. Use the `rad init` command to initialize a new environment into your current kubectl context:

```bash
rad init
```

Follow the prompts to install the [control plane services]({{< ref architecture >}}), create an [environment resource]({{< ref environments >}}), and create a [local workspace]({{< ref workspaces >}}). You will be asked for:

- **Namespace** - When an application is deployed, this is the namespace where your containers and other Kubernetes resources will be run. By default, this will be in the `default` namespace.
{{% alert title="💡 About namespaces" color="success" %}} When you initialize a Radius Kubernetes environment, Radius installs the control plane resources within the `radius-system` namespace in your cluster, separate from your applications. The namespace specified in this step will be used for your application deployments.
{{% /alert %}}
- **Add AWS provider** - An [AWS cloud provider]({{<ref providers>}}) allows you to deploy and manage AWS resources as part of your application. Enter 'y' and follow the instructions. Provide a valid AWS region and the values obtained for IAM Access Key ID and IAM Secret Access Keys.
- **Environment name** - The name of the environment to create. You can specify any name with lowercase letters, such as `myawsenv`.

willtsai marked this conversation as resolved.
Show resolved Hide resolved
## Step 3: Create a Bicep file which uses AWS Simple Storage Service (S3)

Create a new file called `app.bicep` and add the following bicep code:

{{< rad file="snippets/app.bicep" embed=true >}}
AaronCrawfis marked this conversation as resolved.
Show resolved Hide resolved
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

## Step 4: Deploy the application
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

1. Deploy your application to your environment:

```bash
rad deploy ./app.bicep -p aws_access_key_id=<AWS_ACCESS_KEY_ID> -p aws_secret_access_key=<AWS_SECRET_ACCESS_KEY> -p aws_region=<REGION>
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved
```

The access key, secret key, and region can be the same values you used in while creating environment in step 2. These are used so the container we are deploying can connect to AWS. The AWS S3 Bucket name must follow the [following naming conventions](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html).

1. Port-forward the container to your machine with [`rad resource expose`]({{< ref rad_resource_expose >}}):

```bash
rad resource expose containers frontend -a webapp --port 5234
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively the user can use rad run. That will automatically open a port-forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried rad run and the app doesn't load. Could see the log stream but couldn't load the app at localhost:5234

frontend-f759c894b-k4t74 › frontend
frontend-f759c894b-k4t74 frontend info: Microsoft.Hosting.Lifetime[14]
frontend-f759c894b-k4t74 frontend Now listening on: http://[::]:5234
frontend-f759c894b-k4t74 frontend info: Microsoft.Hosting.Lifetime[0]
frontend-f759c894b-k4t74 frontend Application started. Press Ctrl+C to shut down.
frontend-f759c894b-k4t74 frontend info: Microsoft.Hosting.Lifetime[0]
frontend-f759c894b-k4t74 frontend Hosting environment: Production
frontend-f759c894b-k4t74 frontend info: Microsoft.Hosting.Lifetime[0]
frontend-f759c894b-k4t74 frontend Content root path: /app/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Reshrahim could you open a bug with steps to reproduce please?

1. Visit [localhost:5234](http://localhost:5234/swagger/index.html) in your browser. This is a swagger doc for the sample application. You can use this to interact with the AWS S3 Bucket you created. For example, you can try to upload a file to the bucket via the `/upload` endpoint.

Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

## Step 5: Cleanup
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

1. If you're done with testing, you can use the rad CLI to [delete an environment]({{< ref rad_env_delete.md >}}) to delete all Radius resources running on the EKS Cluster.
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

2. Cleanup AWS Resources - AWS resources are not deleted when deleting a Radius environment, so to prevent additional charges, make sure to delete all resources created in this reference app. You can delete these resources in the AWS Console or via the AWS CLI. To delete the AWS S3 Bucket, see https://docs.aws.amazon.com/AmazonS3/latest/userguide/delete-bucket.html.
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

## Next steps
{{< button text="Deploy using AWS recipes" page="quickstart-aws-recipes" >}}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ param aws_region string
resource s3 'AWS.S3/Bucket@default' = {
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved
alias: bucket
properties: {
BucketName: bucket
BucketName: 'mys3bucket'
AccessControl: 'PublicRead'
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved
}
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This reference app will show you:

## Prerequisites

- [Complete the getting started guide for AWS up to Step 2]({{< ref quickstart-aws >}})
- [Complete the getting started guide for AWS up to Step 2]({{< ref quickstart-aws-s3 >}})

## Step 1: Create a Bicep file which uses AWS RDS

Expand Down
51 changes: 0 additions & 51 deletions docs/content/getting-started/reference-apps/aws-s3/_index.md

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This reference app will show you:

## Prerequisites

- [Complete the getting started guide for AWS up to Step 2]({{< ref quickstart-aws >}})
- [Complete the getting started guide for AWS up to Step 2]({{< ref quickstart-aws-s3 >}})

## Step 1: Create a Bicep file which uses AWS Simple Queue Service (SQS)

Expand All @@ -37,7 +37,7 @@ This application models two http services: (1) `producer` and (2) `consumer` tha
rad deploy ./app.bicep -p aws_access_key_id=$AWS_ACCESS_KEY_ID -p aws_secret_access_key=$AWS_SECRET_ACCESS_KEY -p aws_region=$AWS_REGION -p queue_name='queue'
```

The access key, secret key, and region can be the same values you used in the [AWS Quickstart]({{< ref quickstart-aws >}}). These are used so the container we are deploying can connect to AWS. The AWS SQS Queue name must follow the [`Queue name` conventions](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/quotas-queues.html).
The access key, secret key, and region can be the same values you used in the [AWS Quickstart]({{< ref quickstart-aws-s3 >}}). These are used so the container we are deploying can connect to AWS. The AWS SQS Queue name must follow the [`Queue name` conventions](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/quotas-queues.html).

1. Port-forward the container to your machine with [`rad resource expose`]({{< ref rad_resource_expose >}}):

Expand Down