You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求创建Redshift Serverless的CloudFormation基础模板(含命名空间与工作组)

解决Redshift Serverless CloudFormation模板报错并提供完整模板

你遇到的At least one Resources member must be defined报错,核心原因是CloudFormation模板必须包含顶层的Resources节点,所有资源都要嵌套在这个节点下;同时你的模板里ConfigParameters和Tags的格式不符合AWS规范,且缺少了命名空间(Namespace)的定义。

以下是包含命名空间和工作组的完整基础模板,修复了所有问题:

AWSTemplateFormatVersion: '2010-09-09'
Description: 基础Redshift Serverless集群模板(包含命名空间和工作组)

Resources:
  # Redshift Serverless命名空间
  RedshiftServerlessNamespace:
    Type: AWS::RedshiftServerless::Namespace
    Properties:
      NamespaceName: sample-namespace
      AdminUsername: adminuser
      AdminUserPassword: YourSecurePassword123  # 生产环境建议使用Secrets Manager或SSM参数存储
      DbName: sampledb
      Tags:
        - Key: Environment
          Value: Test
        - Key: Application
          Value: RedshiftDemo

  # Redshift Serverless工作组
  RedshiftServerlessWorkgroup:
    Type: AWS::RedshiftServerless::Workgroup
    Properties:
      WorkgroupName: sample-wg
      NamespaceName: !Ref RedshiftServerlessNamespace  # 关联上面创建的命名空间
      BaseCapacity: 8
      EnhancedVpcRouting: false
      PubliclyAccessible: true
      Port: 5439
      SecurityGroupIds:
        - sg-0d84ef5a0ddb2a5f0
      SubnetIds:
        - subnet-06860f6313fb01dea
        - subnet-052ac63eb2d56e361
        - subnet-0e80ec9a22484bc21
      ConfigParameters:
        - ParameterKey: enable_user_activity_logging
          ParameterValue: true
      Tags:
        - Key: Environment
          Value: Test
        - Key: Application
          Value: RedshiftDemo

关键说明

  • 顶层必须包含AWSTemplateFormatVersion和Resources节点,这是CloudFormation模板的强制结构。
  • ConfigParameters需要是包含ParameterKey和ParameterValue的对象数组,不能直接写字符串。
  • Tags同样需要是包含Key和Value的对象数组。
  • 工作组通过!Ref关联命名空间,确保两者绑定正确。
  • 生产环境中禁止明文存储密码,建议使用!Ref引用AWS Secrets Manager的秘密资源。

内容的提问来源于stack exchange,提问作者Shiv Suthar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 05:43:17