sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.29k stars 168 forks source link

How to chnage lambda archtecure on sst.config? #658

Closed yuta-hidaka closed 1 month ago

yuta-hidaka commented 1 month ago

Hi, I've tried to change lambda memory and architecture to arm.

How do write the configs?

/// <reference path="./.sst/platform/config.d.ts" />

export default $config({
  app(input) {
    return {
      name: `MyAPP`,
      removal: input?.stage === "prd" ? "retain" : "remove",
      home: "aws",
      providers: {
        aws: {
          region: "ap-northeast-1", // tokyo
        },
      },
    };
  },
  async run() {
    const secret = new sst.Secret("APIKey", process.env.API_KEY);
    const apiEndpoint = new sst.Secret("ApiEndpoint", process.env.API_ENDPOINT);
    const assetEndpoint = new sst.Secret(
      "AssetEndpoint",
      process.env.ASSETS_ENDPOINT,
    );
    new sst.aws.Astro(`MyAPP`, {
      link: [secret, apiEndpoint, assetEndpoint],
      invalidation: {
        paths: "all",
        wait: true,
      },
    });
  },
});
shmuli9 commented 1 month ago

Use the transform property to modify the underlying resources

eg:

new sst.aws.Astro("AstroApp", {
  transform: {
    server: {
      architecture: "arm64",
      memory: "1024 MB",
    },
  },
});
jayair commented 1 month ago

Yeah that should work.

@fwang should we expose this?

fwang commented 1 month ago

Added top level server prop in v0.0.535

https://ion.sst.dev/docs/component/aws/astro/#server