无服务器 SaaS 系统的 AWS 参考解决方案 - 错误:找不到模板文件 - template.yml

发布于 2025-01-14 08:46:24 字数 2078 浏览 1 评论 0原文

我正在尝试使用 AWS Cloud9 部署 AWS 参考解决方案,该解决方案演示了示例 SaaS 系统。该解决方案的存储库位于:

https://github.com/aws-samples/aws-saas-factory-ref-solution-serverless-saas/blob/main/DOCUMENTATION.md

可以运行一个部署文件来引导 AWS 中的示例系统 - 它位于存储库中的 /aws-saas-factory-ref-solution-serverless-saas/deployment.sh

部署脚本的一部分使用文件 /aws-saas-factory-ref-solution-serverless-saas/server/bootstrap-template.yaml(这是一个 CloudFormation 模板)构建引导资源。然后该脚本根据配置文件 /aws-saas-factory-ref-solution-serverless-saas/server/samconfig-bootstrap.toml

中的相关部分部署 bootstrap 资源 ./deployment执行构建和引导的.sh如下。构建和部署利用 AWS“无服务器应用程序模型”(sam):

sam build -t bootstrap-template.yaml --use-container --region=$REGION
sam deploy --config-file samconfig-bootstrap.toml --region=$REGION --parameter-overrides AdminEmailParameter=$1 

当我在 EC2(新加坡区域)上的 Cloud 9 实例上运行 ./deployment.sh 时,出现以下错误在公共资源引导阶段:

[11034] Failed to execute script main

sam deploy --config-file samconfig-bootstrap.toml --region=ap-southeast-1 --parameter-overrides [email protected]
Error: Template file not found at /home/ec2-user/environment/aws-saas-factory-ref-solution-serverless-saas/server/template.yml

当我搜索 template.yml 的代码时,我没有看到任何内容,所以我不确定是什么试图引用它。该文件不存在于解决方案中。

此处的指南介绍了如何快速设置在 EC2 实例上运行的 AWS Cloud9 环境,可以从其 Github 存储库将解决方案克隆到该环境中,以便运行 ./deployment.sh 脚本 - <一个href="https://catalog.us-east-1.prod.workshops.aws/workshops/b0c6ad36-0a4b-45d8-856b-8a64f0ac76bb/en-US/pre-requirements/12-own-aws-account" rel =“不关注” noreferrer">https://catalog.us-east-1.prod.workshops.aws/workshops/b0c6ad36-0a4b-45d8-856b-8a64f0ac76bb/en-US/pre-requirements/12-own-aws-account

I'm trying to deploy an AWS reference solution using AWS Cloud9, that demonstrates a sample SaaS system. The repo for the solution is here:

https://github.com/aws-samples/aws-saas-factory-ref-solution-serverless-saas/blob/main/DOCUMENTATION.md

There's a deployment file that can be run in order to bootstrap the example system in AWS - it's /aws-saas-factory-ref-solution-serverless-saas/deployment.sh within the repo.

Part of the deployment script builds bootstrap resources using the file /aws-saas-factory-ref-solution-serverless-saas/server/bootstrap-template.yaml, which is a CloudFormation template. The script then deploys bootstrap resources based on the configuration file /aws-saas-factory-ref-solution-serverless-saas/server/samconfig-bootstrap.toml

The relevant parts of ./deployment.sh that perform the build and bootstrap are as follows. The build and deployment utilise the AWS 'Serverless Application Model' (sam):

sam build -t bootstrap-template.yaml --use-container --region=$REGION
sam deploy --config-file samconfig-bootstrap.toml --region=$REGION --parameter-overrides AdminEmailParameter=$1 

When I run the ./deployment.sh on a Cloud 9 instance on EC2 (in Singapore region), I get the following error during the common resource bootstrapping stage:

[11034] Failed to execute script main

sam deploy --config-file samconfig-bootstrap.toml --region=ap-southeast-1 --parameter-overrides [email protected]
Error: Template file not found at /home/ec2-user/environment/aws-saas-factory-ref-solution-serverless-saas/server/template.yml

I'm not seeing anything when I search the code for template.yml, so I'm not sure what's attempting to reference this. The file isn't present in the solution.

The guide here describes how to quickly set up an AWS Cloud9 environment running on an EC2 instance, into which the solution can be cloned from its Github repo in order to run the ./deployment.sh script - https://catalog.us-east-1.prod.workshops.aws/workshops/b0c6ad36-0a4b-45d8-856b-8a64f0ac76bb/en-US/pre-requisites/12-own-aws-account

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绝不服输 2025-01-21 08:46:24

查看 build-spec 文件(buildspec.yaml 文件用于为 AWS CodeBuild 中的 CI/CD 提供元数据),AWS 团队似乎正在使用 CI/CD Pipelines 测试部署,但忘记了更新 shell 脚本。

另一方面,您无需担心构建规范文件。

解决方案
只需将 template.yml 更改为 tenant-template.yaml

After looking at the build-spec file (buildspec.yaml files are used to provide meta-data for CI/CD in AWS CodeBuild), it seems that the AWS team is testing the deployment using CI/CD Pipelines and forgot to update the shell script.

You on the other hand don't need to worry about the the build-spec file.

Solution
Go and just change template.yml to tenant-template.yaml

千仐 2025-01-21 08:46:24

我发现 template.yml 是通常在构建过程中生成的工件 - 请参阅 SAM 部署命令参考

sam 部署

默认情况下,当您使用此命令时,AWS SAM CLI 假定
您当前的工作目录是项目的根目录。这
AWS SAM CLI 首先尝试查找使用 sam 构建的模板文件
构建命令,位于 .aws-sam 子文件夹中,并命名为
模板.yaml。

由于运行 Cloud9 的 EC2 实例内存大小不足,似乎未创建 template.yml

@ujwalbukka 在以下 git 问题中,在参考解决方案的存储库中:

https://github.com/aws- Samples/aws-saas-factory-ref-solution-serverless-saas/issues/19

为了让 SaaS 参考解决方案在 Cloud9 中运行,我在 Cloud9 中克隆了一个额外的存储库( SaaS 参考解决方案的 AWS workshop 存储库)。我使用 git clone https://github.com/aws-samples/aws-serverless-saas-workshop.git 克隆了它。

克隆该存储库后,我执行了以下步骤此处 运行研讨会中存在的脚本存储库,增加 Cloud9 EC2 实例大小并安装运行参考解决方案的先决条件。

I found out that template.yml is an artifact that's normally produced during the build process - see SAM deploy command reference

sam deploy

By default when you use this command, the AWS SAM CLI assumes that
your current working directory is your project's root directory. The
AWS SAM CLI first tries to locate a template file built using the sam
build command, located in the .aws-sam subfolder, and named
template.yaml.

It seems that the template.yml wasn't being created due to insufficient memory size of the EC2 instance that Cloud9 was running in.

The solution for this was provided by @ujwalbukka in the following git issue, within the repo for the reference solution:

https://github.com/aws-samples/aws-saas-factory-ref-solution-serverless-saas/issues/19

To get the SaaS reference solution to run in Cloud9, I cloned an additional repo inside Cloud9 (the repo for the AWS workshop for the SaaS reference solution). I cloned this using git clone https://github.com/aws-samples/aws-serverless-saas-workshop.git

After cloning that repo, I ran through the steps here to run scripts that exist in the workshop repo, that increase the Cloud9 EC2 instance size and install the prerequisites for running the reference solution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文