标签: aws-cloudformation

无法在 cloudformation 中使用 https 设置我的弹性负载均衡器

我在启用 https 协议的情况下为 beanstalk 设置 cloudformation 时遇到问题。

这是我的配置设置:

 configurationTemplateUI:
Type: AWS::ElasticBeanstalk::ConfigurationTemplate
DependsOn: BeanstalkAppUI
Properties:
  ApplicationName:
    Ref: BeanstalkAppUI
  Description: AWS ElasticBeanstalk Sample Configuration Template
  OptionSettings:
  - Namespace: aws:autoscaling:asg
    OptionName: MinSize
    Value:
      Ref: MinEc2s
  - Namespace: aws:autoscaling:asg
    OptionName: MaxSize
    Value:
      Ref: MaxEc2s
  - Namespace: aws:elasticbeanstalk:environment
    OptionName: EnvironmentType
    Value: LoadBalanced
  - Namespace: aws:autoscaling:launchconfiguration
    OptionName: InstanceType
    Value:
      Ref: InstanceType
  - Namespace: aws:ec2:vpc
    OptionName: VPCId
    Value:
      Fn::ImportValue: !Sub ${BusinessUnit}-${EnvironmentInfra}-vpc-VpcId
  - Namespace: aws:ec2:vpc
    OptionName: Subnets
    Value:
      Fn::ImportValue: !Sub ${BusinessUnit}-${EnvironmentInfra}-vpc-SubnetIdPrivate${SubnetAvNumber}
  - Namespace: aws:ec2:vpc
    OptionName: ELBSubnets
    Value:
      Fn::ImportValue: …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-cloudformation aws-opsworks amazon-elastic-beanstalk

0
推荐指数
1
解决办法
1771
查看次数

使用 Cloudformation 将多个 BlockDeviceMappings 安装到 EC2 实例

我尝试使用 cloudformation 将多个 EBS 卷安装到我的 EC2 实例,但由于某种原因,仅安装了我指定的最后一个 EBS 卷。

EG:
NewEC2Instance:
    Type: AWS::EC2::Instance
    DependsOn: OldSecurityGroup
    Properties:
      ImageId: !Ref pImageId
      InstanceType: !Ref pInstanceType
      BlockDeviceMappings:
        -
          DeviceName: /dev/sda1
          Ebs:
            VolumeSize: 10
          DeviceName: /dev/sdf
          Ebs:
            VolumeSize: 11
            Encrypted: true
          DeviceName: /dev/sdg
          Ebs:
            VolumeSize: 12
            Encrypted: true 
          DeviceName: /dev/sdh
          Ebs:
            VolumeSize: 100
            Encrypted: true 
Run Code Online (Sandbox Code Playgroud)

对于上面的代码,仅创建 100Gb /dev/sdh。

我认为 Cloudformation 正在覆盖 EBS 卷。

有人知道为什么吗?请帮忙!

amazon-ec2 amazon-ebs amazon-web-services aws-cloudformation

0
推荐指数
1
解决办法
3076
查看次数

如果所需的容器数量大于 1,则 ECS 服务处于挂起状态

我正在使用 ECS 服务创建 Cloudformation 堆栈。如果我将DesiredCount值设置为 1,堆栈就会完成创建。

但是当我将计数增加到 2 时,我仍然发现只有一个任务正在运行。任务运行正常,没有错误,但 cloudformation 卡在 CREATE_IN_PROGRESS 状态,一段时间后表明 ECS 服务无法稳定。可能是因为它未能生成剩余的所需任务。

这种行为的原因可能是什么?

amazon-web-services amazon-ecs aws-cloudformation

0
推荐指数
1
解决办法
2496
查看次数

CloudFormation 资源 AWS::S3::Bucket 未显示在 S3 控制台中

使用我的 cloudformation 模板,我能够在堆栈中创建两个存储桶和一个存储桶策略。事实证明我的存储桶策略具有错误的权限,因此我决定删除存储桶并使用新模板重新创建它们。

cloudformation 似乎没有检测到我删除的 s3 存储桶。这些存储桶仍然显示在我的堆栈资源中,但被标记为“已删除”已将其删除,但未检查政策

我的堆栈也被标记为漂移。当我尝试通过 cloudformation 中的链接访问 s3 存储桶时,我收到“错误数据未找到” 错误 未找到数据。

我的堆栈处于这种状态大约有 16 个小时。关于如何让 cloudformation 与 s3 同步有什么想法吗?

amazon-s3 amazon-web-services aws-cloudformation

0
推荐指数
1
解决办法
792
查看次数

获取 EIP 作为 aws-cdk 生成的 VPC 定义的输出

有一个 vpc 定义

 const vpc = new ec2.Vpc(this, 'SomeVPC', {
        cidr: '10.0.0.0/16',
        maxAzs: 2,
 });
Run Code Online (Sandbox Code Playgroud)

它在底层为 NAT 网关创建 2 个 EIP

"SomeVPCPublicSubnet1EIP58E3D6C5": {
  "Type": "AWS::EC2::EIP",
  "Properties": {
    "Domain": "vpc"
  }
}
Run Code Online (Sandbox Code Playgroud)

如何获取对它们的引用并通过导出CfnOutput?像这样的东西:

new CfnOutput(this, "ExternalIPOutput", {value: <some magic call to get SomeVPCPublicSubnet1EIP58E3D6C5.ref()>})
Run Code Online (Sandbox Code Playgroud)

aws-cloudformation aws-cdk

0
推荐指数
1
解决办法
1808
查看次数

Hash 和 Range 键在 AWS DynamoDb 中究竟意味着什么?

我是 DynamoDb 的新手,我确实查看了 AWS 文档以及一些有关 Hash 和 Range 键的问题。毕竟,我仍然不确定它们的确切含义以及您为什么/如何使用它们。有人可以用一个例子给我一个简单的解释吗?

例如,如果我想创建一个Movie有桌子NameGenreRatingDateReleased列。创建 DynamoDb 表的正确方法是什么。在下面的示例中,我有一些 CloudFormation 来尝试创建以下内容,但我不确定我是否正确使用了 KeySchema 属性。任何帮助,将不胜感激。

MovieTable:
    Type: AWS::DynamoDB::Table
    Properties:
      BillingMode: PAY_PER_REQUEST
      AttributeDefinitions:
        - AttributeName: "Name"
          AttributeType: "S"
        - AttributeName: "Genre"
          AttributeType: "S"
        - AttributeName: "Rating"
          AttributeType: "N"
        - AttributeName: "DateReleased"
          AttributeType: "S"
      KeySchema:
      - AttributeName: "Name"
        KeyType: "HASH"
      - AttributeName: "Genre"
        KeyType: "RANGE"
      - AttributeName: "Rating"
        KeyType: "RANGE"
      - AttributeName: "DateReleased"
        KeyType: "RANGE"
      TimeToLiveSpecification:
        AttributeName: ExpireAfter
        Enabled: false
      SSESpecification: …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services node.js aws-cloudformation amazon-dynamodb

0
推荐指数
1
解决办法
648
查看次数

CloudFormation 模板不选择密钥对

我使用以下方法成功创建了以下四个资源Cloud Formation Template (CFT)

  1. 专有网络
  2. 子网
  3. 互联网网关
  4. 连接网关

现在,我正在尝试使用 EC2 实例创建一个安全组,这是代码。

  Type: AWS::EC2::SecurityGroup
  Properties:
      GroupDescription: Allow http and ssh to client host
      VpcId:
         Ref: InsuranceVPC
      SecurityGroupIngress:
      - IpProtocol: tcp
        FromPort: 80
        ToPort: 80
        CidrIp: 0.0.0.0/0
      - IpProtocol: tcp
        FromPort: 22
        ToPort: 22
        CidrIp: 0.0.0.0/0
      SecurityGroupEgress:
      - IpProtocol: tcp
        FromPort: 80
        ToPort: 80
        CidrIp: 0.0.0.0/0

Ec2Instance: 
  Type: AWS::EC2::Instance
  Properties: 
    ImageId: "ami-08706cb5f68222d09"
    KeyName: 
      Ref: "DevOpsAutomation"
    NetworkInterfaces: 
      - AssociatePublicIpAddress: "true"
        DeviceIndex: "0"
        GroupSet: 
          - Ref: "InsuranceSecurityGroup"
        SubnetId: 
          Ref: "InsuranceSubnet"
Run Code Online (Sandbox Code Playgroud)

但是,当我在(CFT,如上所示,代码)中使用 Key …

amazon-ec2 amazon-web-services aws-cloudformation aws-cloudformation-custom-resource

0
推荐指数
1
解决办法
1180
查看次数

参数值在 aws cli Cloudformation 中不起作用

我正在通过 AWS CLI 运行我的云形成模板。它工作正常并在 AWS 门户上创建堆栈,但我面临一个问题,即无法更改默认参数值。我使用 CLI 传递我自己的参数,但只有最后一个参数值从堆栈中发生变化(即 30),其余的没有变化,而是从模板主体中选择默认值。我已经通过更改参数的位置尝试了所有可能的方法,但它仍然相同。所以请让我知道我将如何解决这个恼人的问题。这是我的命令:-

aws --region eu-north-1 cloudformation  create-stack --stack-name cli4  --template-body file://app_cli.json --parameters "ParameterKey"="Maxvalue","ParameterValue"="7","ParameterKey"="increment","ParameterValue"="1","ParameterKey"="incrementtime","ParameterValue"="30"

"Parameters": {
        "EnvironmentName": {
            "Description": "An environment name that will be prefixed to resource names",
            "Type": "String",
            "Default": "Codavel"
        },
        "amiID": {
        "Description": "Put ami-id in this",
        "Type": "String",
        "Default": "ami-085045326daf7e309"
        },
        "Maxvalue": {
        "Description": "Put max value in this",
        "Type": "String",
        "Default": "100"
        },
        "increment": {
        "Description": "Put No. of incremental instance this",
        "Type": "String",
        "Default": "2"
        },
        "incrementtime": …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-cloudformation aws-cli devops aws-cloudformation-custom-resource

0
推荐指数
1
解决办法
1784
查看次数

ECS 任务的任务执行角色 - Cloudformation

我正在尝试访问使用 aws 控制台创建的 IAM 角色。该角色很简单,因为我必须提供 ecs taskexcutionrole,以便它有权从 ECR 中提取映像。我已经想出了这段代码,我在这段代码中缺少什么?

    Role:
        Type: 'AWS::IAM::Role'
        Properties:
          AssumeRolePolicyDocument:
            Version: '2012-10-17'
            Statement:
              - Effect: Allow
                Principal:
                  Service:
                    - ec2.amazonaws.com
                Action:
                  - 'sts:AssumeRole'
          Path: /
          ManagedPolicyArns:
            - arn:aws:iam::02004621356:role/ecs-ec2-task
Run Code Online (Sandbox Code Playgroud)

2- 如果我想创建一个新的任务执行角色并仅授予从 ECR 提取映像的权限,我应该进行哪些更改?

amazon-web-services amazon-ecs aws-cloudformation amazon-iam

0
推荐指数
1
解决办法
2394
查看次数

接收到检测到的验证错误:值 '[AWS:RDS::DBInstance]' at 'typeNameList' 失败

我正在尝试创建一个运行 MySQL 数据库的 RDS 服务器并收到以下错误:

1 validation error detected: Value '[AWS:RDS::DBInstance]' at 'typeNameList' failed to satisfy constraint: Member must satisfy constraint: [Member must have length less than or equal to 204, Member must have length greater than or equal to 10, Member must satisfy regular expression pattern: [A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}]

AWSTemplateFormatVersion: 2010-09-09

Parameters:
  DBName:
    Type: String
    AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
  MUser:
    Type: String
    AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
  MPass:
    Type: String
    AllowedPattern: '[a-zA-Z0-9]*'
    Description: "It shouldn't be less than 8 characters"
    
Resources:
  MyDBInstance:
    Type: AWS:RDS::DBInstance
    Properties:
      DBName: …
Run Code Online (Sandbox Code Playgroud)

amazon-ec2 amazon-rds aws-cloudformation

0
推荐指数
1
解决办法
642
查看次数