@104corp/cdk-aws-codedeploy-on-premises 中文文档教程
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
Name | Type | Description |
---|---|---|
projectName | string | The name of the project. |
projectStage | string | The name of the stage. It's naming dev, staging, and production typically. |
deploymentGroups | DeploymentGroups[] | Specify name for CodeDeploy deployment groups and instances |
slackWebhookURL? | string | slack web hook url |
autoRegisterInstance? | boolean | Using 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 用户。
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
Name | Type | Description |
---|---|---|
projectName | string | The name of the project. |
projectStage | string | The name of the stage. It's naming dev, staging, and production typically. |
deploymentGroups | DeploymentGroups[] | Specify name for CodeDeploy deployment groups and instances |
slackWebhookURL? | string | slack web hook url |
autoRegisterInstance? | boolean | Using 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