Loading

    Additional AWS Getting Started Resources

    Adam ElmoreAdam Elmore

    Exploring Resources in AWS

    In the previous lesson, we deployed an XJS app using SST (Serverless Stack Toolkit) in our own AWS account. But what exactly did we deploy? Let's explore the resources that were created in our account.

    What are Resources?

    Resources are like objects in our AWS account. Each service, like Lambda, can have one or more resource types, which are similar to classes in object-oriented programming. The actual resources deployed into your account, such as Lambda functions, are like instances of those classes.

    SST is responsible for figuring out and deploying the necessary resources to support the infrastructure we've defined in our TypeScript definitions.

    Viewing Resources with Resource Explorer

    To view the resources deployed in our account, we'll use the Resource Explorer service in the AWS Access Portal. This service allows us to search across all regions and inventory the various services and resources in our account.

    1. Enable Resource Explorer by following the setup process and configuring the aggregator index region (e.g., US East 1).
    2. Once indexing is complete, navigate to the Resource Search page.

    Here, you'll see a list of all the resources deployed in your account, including their resource types (e.g., Lambda function).

    Understanding Amazon Resource Names (ARNs)

    Each resource in AWS has a unique identifier called an Amazon Resource Name (ARN). You can typically find the ARN on the resource's landing page. ARNs are used to identify and interact with resources programmatically, such as when invoking a Lambda function through the API or SDKs.

    Resource Tags

    Resources can have tags, which are custom labels used for categorization and organization. SST automatically adds tags for the app name and stage (e.g., dev, staging, production) to every resource it deploys.

    You can use these tags to filter resources in the Resource Explorer. For example, to find resources for a specific app and stage, you can use the following query:

    tag:sst-app=<app-name> tag:sst-stage=<stage-name>
    

    This allows you to easily identify and manage resources belonging to different apps and stages, especially when multiple developers are sharing the same account.

    Exploring Deployed Resources

    Take some time to explore the resources deployed by SST for your XJS app. You can filter by resource types (e.g., S3 buckets) or use other queries to understand the infrastructure supporting your application.

    Remember, you're operating within the AWS Free Tier, so there's no need to worry about costs while exploring. Gaining familiarity with the deployed resources will provide valuable context as you continue working with SST and AWS.

    Transcript

    In the last lesson, we deployed an XJS app in our own AWS account with SST. But how does that show up in our account? What did we actually do to our account? Well, ultimately, we deployed a whole bunch of resources, or SST did on our behalf. So what are resources?

    Well, they're like the objects in our account. To take an object-oriented programming parallel, resource types, like a lambda function, are like a class. And the actual functions that end up deployed into your account are the objects. Now, each service, like Lambda, can have one or more classes or resource types. This analogy is stupid, I shouldn't have used it.

    But ultimately, SST is in charge of figuring out exactly what resources need to be deployed into our account to support the infrastructure we've defined in our TypeScript definitions. So, how do we see those in the account? How do we go into our account and see exactly what just happened? Well, let's log in to our development account in the AWS Access Portal. And we're going to go to a service called Resource Explorer.

    And this is a relatively new service that AWS provided to much excitement within the community, because we've never really had a tool like this to search across all regions in our account and inventory the various services and resources that are deployed in our account. So we're going to first, because it's the first time we're coming in here, we have to turn on Resources Explorer. We're just going to do a quick setup. We're going to choose the current region which is US East 1 as the aggregator index region and I think that's it. This is a free service.

    It's called out here at the bottom. But they make us go through this step just to configure it. So let's turn on Resource Explorer. It's going to create the indexes, basically the searchable databases in each region. And now we can go to resource search once it's finished indexing each region.

    So here we get a list of all of the resources deployed into our account. There's a few things I want to call out about resources. You can see the resource type, Like I said, these are like the classes and OOP terms. So we have a Lambda function here. And if we just dive into this Lambda function, each resource in AWS has something called an ARN, an Amazon Resource, wait.

    Amazon Resource Number, what? ARN, what is an ARN? Stand for? A name, it's a name. Amazon Resource Names.

    Every resource deployed into your AWS account has a unique identifier. It's called the ARN, or Amazon Resource Name. And you can usually see that on the landing page for any given resource. Here you can see the function ARN. So this is a unique identifier.

    You'll use this all over the place. In the API or through the SDKs, if you're invoking the function programmatically, you have to provide the function ARN. This is how you identify resources in your account. Resources can also have tags, which are just like what you would think a tag is. So the ability to kind of categorize resources based on custom needs that you might have.

    Well, SST adds tags for the app name and stage on every resource it deploys. So when we created our SST app, we gave it a name, Next.js app, and as I mentioned, every developer will have its own stage, there will be a production stage, you might have a test stage, or a staging stage. So in this case, this Lambda function is deployed for the Next.js app in the Atom stage, which is my developer stage. So with that information in mind, we can come in here and actually search through resources to find only resources for that particular app in that stage. So this query, keywords, filters, and operators text box here, we can actually use some syntax.

    And I could link some documentation for how this works. But for now, we're just concerned with tags. So let's say tag sst app equals Next.js app. And if we click Enter, or if we just hit Enter, it's going to go from 17 resources to 0. Oh, I forgot the hyphen.

    So 17 resources. All the resources in this account have that tag, because all we've done is deploy the one stage. But we could similarly filter sst stage equals atom. And again, we haven't deployed any other stages. But imagine you have multiple developers sharing this staging or this dev account, all deploying their app.

    We could filter down to look at only resources that belong to each developer and all the resources that make up their stage. So then you can filter by resource types. We could say we just want to look at S3 buckets within this particular stage of this app. So here you can see all of the different resources that were deployed into your account. Again, we're within the free tier on all of these, so you don't need to be concerned about cost.

    But I would encourage you to go through and kind of poke around and get an idea of which resources were deployed to support an XJS site, because that'll be useful context down the line.