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 2 commits
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,61 @@ 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 --parameters eksClusterName=YOUR_EKS_CLUSTER_NAME
Reshrahim marked this conversation as resolved.
Show resolved Hide resolved
```
> *Note: Passing the `eksClusterName` during the registration of the Recipe is a temporary additional step as Radius builds up AWS support.*

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.

1. Deploy your application to your environment:

```bash
rad deploy ./app.bicep
```

This operation may take some time, as the ‘aws’ Recipe is deploying an AWS MemoryDB for Redis resource in your AWS account. Once complete, you should see:

```
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 All @@ -212,11 +265,12 @@ This step requires an Azure subscription to deploy cloud resources, which will i

## Step 5: Cleanup your environment

You can use the rad CLI to [delete your environment]({{< ref rad_env_delete.md >}}) and all the Radius resources running on your cluster:
1. You can use the rad CLI to [delete your environment]({{< ref rad_env_delete.md >}}) and all the Radius resources running on your cluster:

```bash
rad env delete default --yes
```
```bash
rad env delete default --yes
```
1. Delete the Azure Redis cache via the Azure CLI or the Azure portal, and the AWS Memory DB for Redis via the AWS CLI or the AWS console.

## Next steps

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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'
}
}
}
//DB
Loading