简体   繁体   English

如何在无服务器配置文件中设置AWS :: AccountId?

[英]how to set AWS::AccountId in serverless config file?

I have a serverless.yml file that contains the following: 我有一个serverless.yml文件,其中包含以下内容:

  environment:
    accountId: '#{AWS::AccountId}'
    region: us-east-2

env.accountId is coming back as undefined. env.accountId返回为未定义。 Where and how do I set that? 我在哪里以及如何设置?

Ensure you have the serverless-pseudo-parameters installed. 确保已安装了无服务器伪参数

Install the package with npm: npm install serverless-pseudo-parameters , and add it to your serverless.yml plugins list: 使用npm安装软件包: npm install serverless-pseudo-parameters ,并将其添加到serverless.yml插件列表中:

plugins:
  - serverless-pseudo-parameters

Also, make sure you have AWS credentials available on the machine you are running from. 此外,请确保在运行机器的计算机上具有可用的AWS凭证。 These are needed to resolve these values. 这些是解析这些值所必需的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 serverless.yml 文件中获取 AccountId 作为变量? - How do I get the AccountId as a variable in a serverless.yml file? CloudFormation:如何在映射中使用AWS :: AccountId? - CloudFormation: How to use AWS::AccountId in Mappings? AWS Grafana/CloudWatch - 如何通过 accountId 显示账单 - AWS Grafana/CloudWatch - How to show Bill by accountId 使用 Maven 部署 AWS 无服务器应用程序时如何设置文件的文件权限 - How do I set file permissions on a file when deploying an AWS Serverless Application with Maven 在AWS Lambda serverless.template文件中设置EndpointConfiguration - Set EndpointConfiguration in AWS Lambda serverless.template file c# 如何在 AWS Lambda 调用中识别 accountId 和 Region? - c# How to identify accountId and Region in a AWS Lambda call? 如何在 REST API 的 uri(Cloudformation) 中传递 AWS AccountId - How to pass AWS AccountId in REST API's uri(Cloudformation) AWS RDS Aurora PostgreSQL无服务器:如何将公共可访问性设置为是 - AWS RDS Aurora PostgreSQL serverless: How to set public accessibility to Yes 如何在 serverless.yml 中设置 AWS Lambda 的重试次数? - How to set the number of retry attempts of AWS Lambda in serverless.yml? 如何在 serverless.yml 中为 AWS SQS 设置 maximumBatchingWindowInSeconds? - How to set maximumBatchingWindowInSeconds for AWS SQS in serverless.yml?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM