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

Add AWS recipes to recipes tutorial #656

Merged
merged 16 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ Note that no Recipe name is specified with 'db', so it will be using the default

<img src="todoapp.png" width="700px" alt="screenshot of the todo application">

## Step 4: Use Azure recipes in your application
## Step 4: Use Azure/AWS recipes in your application

This step requires an Azure subscription to deploy cloud resources, which will incur costs. You will need to add the [Azure cloud provider]({{< ref providers >}}) to your environment in order to deploy Azure resources and leverage Azure Recipes.
This step requires an Azure subscription or an AWS account to deploy cloud resources, which will incur costs. You will need to add the [Azure /AWS cloud provider]({{< ref providers >}}) to your environment in order to deploy Azure resources and leverage Azure Recipes.
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved

{{< button text="Add a cloud provider" page="providers#configure-a-cloud-provider" newtab="true" >}}

{{< tabs Azure >}}
{{< tabs Azure AWS>}}
{{% codetab %}}

1. Delete your existing Redis cache, which we will redeploy with an Azure resource:
Expand Down Expand Up @@ -186,8 +186,6 @@ This step requires an Azure subscription to deploy cloud resources, which will i
db Applications.Link/redisCaches
```

{{% /codetab %}}
{{< /tabs >}}

5. Use the az CLI to see your newly deployed Azure Cache for Redis:

Expand All @@ -203,6 +201,64 @@ This step requires an Azure subscription to deploy cloud resources, which will i
]
```

{{% /codetab %}}

{{% codetab %}}

> *You can run this only on an EKS cluster. Make sure that the each of the Subnets in your EKS cluster Subnet Group are within the [list of supported MemoryDB availability zones](https://docs.aws.amazon.com/memorydb/latest/devguide/subnetgroups.html)*

1. Delete your existing Redis cache, which we will redeploy with an AWS resource:

```bash
rad resource delete rediscaches db
```

1. Register the Recipe to your Radius Environment:

```bash
rad recipe register aws --environment default --template-kind bicep --template-path radius.azurecr.io/recipes/rediscaches/aws:1.0 --link-type Applications.Link/redisCaches --template-kind bicep
AaronCrawfis marked this conversation as resolved.
Show resolved Hide resolved
```

1. Update your db resource to use the `aws` Recipe, instead of the default Recipe:
AaronCrawfis marked this conversation as resolved.
Show resolved Hide resolved

{{< rad file="snippets/app-aws.bicep" marker="//DB" embed=true >}}

Update the recipe name to `aws` to use the Amazon MemoryDB for Redis and pass the `eksClusterName` as parameter to the recipe.

> *Note: Passing the `eksClusterName` during the registration of the Recipe is a temporary additional step as Radius builds up AWS support.*

1. Deploy your application to your environment:

```bash
rad deploy ./app.bicep --parameters eksClusterName=YOUR_EKS_CLUSTER_NAME
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved
```

Make sure to replace `YOUR_EKS_CLUSTER_NAME` with your EKS cluster name.

This will deploy the application into your environment and launch the container resource for the frontend website. This operation may take some time, since it is deploying a MemoryDB resource to AWS. You should see the following resources deployed at the end of `rad deploy`:

```
Building ./app.bicep...
Deploying template './app.bicep' for application 'recipes' and environment 'default' from workspace 'default'...

Deployment In Progress...

Completed webapp Applications.Core/applications
Completed db Applications.Link/redisCaches
Completed frontend Applications.Core/containers

Deployment Complete

Resources:
webapp Applications.Core/applications
frontend Applications.Core/containers
db Applications.Link/redisCaches
```

{{% /codetab %}}

{{< /tabs >}}
AaronCrawfis marked this conversation as resolved.
Show resolved Hide resolved

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

```bash
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import radius as radius

@description('The ID of your Radius environment. Automatically injected by the rad CLI.')
param environment string

@description('The ID of your Radius application. Automatically injected by the rad CLI.')
param application string

@description('Name of the EKS cluster used for app deployment')
param eksClusterName string

//DB
resource db 'Applications.Link/redisCaches@2022-03-15-privatepreview' = {
name: 'db'
properties: {
environment: environment
application: application
recipe: {
// Name a specific recipe to use
name: 'aws'
parameters: {
eksClusterName: eksClusterName
}
}
}
}
//DB
Loading