@104corp/cdk-aws-codedeploy-on-premises 中文文档教程

发布于 3年前 浏览 17 项目主页 更新于 3年前

Build Status

cdk-aws-codedeploy-on-premises

CDK Construct for AWS CodeDeploy on premises

Usage

示例

new CodeDeployOnPremises(this, 'CodeDeployOnPremises', {
  projectName: 'Example Project',
  projectStage: 'production',
  deploymentGroups: [
    {
      name: 'Master',
      instances: [
        name: 'instance01',
        name: 'instance02',
      ],
    },
    {
      name: 'Slave',
      instances: [
        name: 'instance01',
        name: 'instance02',
      ],
    }
  ],
});

Construct Props

NameTypeDescription
projectNamestringThe name of the project.
projectStagestringThe name of the stage. It's naming dev, staging, and production typically.
deploymentGroupsDeploymentGroups[]Specify name for CodeDeploy deployment groups and instances
slackWebhookURL?stringslack web hook url
autoRegisterInstance?booleanUsing AWSUtility::CloudFormation::CommandRunner to register instance on premises

projectName

  • Determines a part of the instance name. It look like ${projectName}-${projectStage}-${instanceName}.
  • Determines a part of AWS IAM user name for Travis CI. It look like TravisCIUser-${projectName}-${projectStage}
  • Determines a part of CodeDeploy application name. It look like ${projectName}-${projectStage}
  • Determines a part of AWS IAM role name for CommandRunner. It look like ${projectName}-${projectStage}-EC2RunCommandRole

projectStage

我与 projectName 属性相同。

deploymentGroups

格式在示例代码中。 请参阅 用法 部分。

slackWebhookURL?

将状态消息通知到松弛通道。 触发部署事件在下面的列表中

  • DeploymentStart
  • DeploymentSuccess
  • DeploymentFailure

autoRegisterInstance?

默认为真。

AWS CodeDeploy on premises 需要为每个实例注册。 它可以通过 AWS CLI 或 API 注册。

如果使用 AWS CLI,它看起来像 aws deploy register --instance-name ${instanceName} --iam-user-arn ${user.userArn} --tags Key=Name,Value=${instanceName} - -区域 ${Aws.REGION}

Construct 在使用 AWSUtility::CloudFormation::CommandRunner CloudFormation 资源类型的 EC2 上执行命令。

查看更多详细信息

IAM User Generation

  • TravisCIUser-${projectName}-${projectStage}

该构造将为 Travis CI 生成 IAM 用户。 使用 IAM 用户的凭证在 .travis.yml 文件上设置。

查看有关 AWS CodeDeploy 的 Travis CI 设置

  • CodeDeployUser-OnPrem-${groupName}-${instanceName}

的更多详细信息该构造将为 CodeDeploy 代理生成 IAM 用户。

第 4 步:添加配置中查看更多详细信息文件到本地实例

Build Status

cdk-aws-codedeploy-on-premises

CDK Construct for AWS CodeDeploy on premises

Usage

Example

new CodeDeployOnPremises(this, 'CodeDeployOnPremises', {
  projectName: 'Example Project',
  projectStage: 'production',
  deploymentGroups: [
    {
      name: 'Master',
      instances: [
        name: 'instance01',
        name: 'instance02',
      ],
    },
    {
      name: 'Slave',
      instances: [
        name: 'instance01',
        name: 'instance02',
      ],
    }
  ],
});

Construct Props

NameTypeDescription
projectNamestringThe name of the project.
projectStagestringThe name of the stage. It's naming dev, staging, and production typically.
deploymentGroupsDeploymentGroups[]Specify name for CodeDeploy deployment groups and instances
slackWebhookURL?stringslack web hook url
autoRegisterInstance?booleanUsing AWSUtility::CloudFormation::CommandRunner to register instance on premises

projectName

  • Determines a part of the instance name. It look like ${projectName}-${projectStage}-${instanceName}.
  • Determines a part of AWS IAM user name for Travis CI. It look like TravisCIUser-${projectName}-${projectStage}
  • Determines a part of CodeDeploy application name. It look like ${projectName}-${projectStage}
  • Determines a part of AWS IAM role name for CommandRunner. It look like ${projectName}-${projectStage}-EC2RunCommandRole

projectStage

I's the same with projectName property.

deploymentGroups

The format is in example code. See Usage section.

slackWebhookURL?

Notify message of status to slack channel. Trigger deployment event is list below

  • DeploymentStart
  • DeploymentSuccess
  • DeploymentFailure

autoRegisterInstance?

Default is true.

AWS CodeDeploy on premises need to register for each instance. It can register by AWS CLI or API.

If use AWS CLI, it look like aws deploy register --instance-name ${instanceName} --iam-user-arn ${user.userArn} --tags Key=Name,Value=${instanceName} --region ${Aws.REGION}.

The Construct execute the command on EC2 which using AWSUtility::CloudFormation::CommandRunner CloudFormation resource type.

See more details

IAM User Generation

  • TravisCIUser-${projectName}-${projectStage}

The construct will generate the IAM user for Travis CI. Using the credential of IAM user to set on .travis.yml file.

See more details on Travis CI setting for AWS CodeDeploy

  • CodeDeployUser-OnPrem-${groupName}-${instanceName}

The construct will generate the IAM user for CodeDeploy agent.

See more details on Step 4: Add a configuration file to the on-premises instance

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