cfn-init and cfn-signal are missing the --role and --url options which are required in us-iso-east-1 and us-isob-east-1 regions.
|
// To identify the resources that have the metadata and where the signal |
|
// needs to be sent, we need { region, stackName, logicalId } |
|
const resourceLocator = `--region ${Aws.REGION} --stack ${Aws.STACK_NAME} --resource ${attachedResource.logicalId}`; |
|
const configSets = (attachOptions.configSets ?? ['default']).join(','); |
|
const printLog = attachOptions.printLog ?? true; |
|
|
|
if (attachOptions.embedFingerprint ?? true) { |
|
// It just so happens that the comment char is '#' for both bash and PowerShell |
|
attachOptions.userData.addCommands(`# fingerprint: ${fingerprint}`); |
|
} |
|
|
|
if (attachOptions.platform === OperatingSystemType.WINDOWS) { |
|
const errCode = attachOptions.ignoreFailures ? '0' : '$LASTEXITCODE'; |
|
attachOptions.userData.addCommands(...[ |
|
`cfn-init.exe -v ${resourceLocator} -c ${configSets}`, |
|
`cfn-signal.exe -e ${errCode} ${resourceLocator}`, |
|
...printLog ? ['type C:\\cfn\\log\\cfn-init.log'] : [], |
|
]); |
|
} else { |
|
const errCode = attachOptions.ignoreFailures ? '0' : '$?'; |
|
attachOptions.userData.addCommands(...[ |
|
// Run a subshell without 'errexit', so we can signal using the exit code of cfn-init |
|
'(', |
|
' set +e', |
|
` /opt/aws/bin/cfn-init -v ${resourceLocator} -c ${configSets}`, |
|
` /opt/aws/bin/cfn-signal -e ${errCode} ${resourceLocator}`, |
Reproduction Steps
Generated CloudFormation template snippet:
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash\n# fingerprint: c94217d36a051c4c\n(\n set +e\n /opt/aws/bin/cfn-init -v --region ",
{
"Ref": "AWS::Region"
},
" --stack ",
{
"Ref": "AWS::StackName"
},
" --resource ASG46ED3070 -c default\n /opt/aws/bin/cfn-signal -e $? --region ",
{
"Ref": "AWS::Region"
},
" --stack ",
{
"Ref": "AWS::StackName"
},
" --resource ASG46ED3070\n cat /var/log/cfn-init.log >&2
What did you expect to happen?
cfn-init command that is automatically injected into the user data will work in all regions.
What actually happened?
Received 0 SUCCESS signal(s) out of X. Unable to satisfy Y% MinSuccessfulInstancesPercent requirement
Environment
- CDK CLI Version :
1.116.0
- Framework Version:
monocdk 1.102.0
- Node.js Version:
v14.17.4
- OS : macOS Big Sur 11.5.1
- Language (Version): TypeScript (4.0.7)
Other
This is 🐛 Bug Report
cfn-initandcfn-signalare missing the--roleand--urloptions which are required inus-iso-east-1andus-isob-east-1regions.aws-cdk/packages/@aws-cdk/aws-ec2/lib/cfn-init.ts
Lines 125 to 150 in 7966f8d
Reproduction Steps
Generated CloudFormation template snippet:
What did you expect to happen?
cfn-initcommand that is automatically injected into theuser datawill work in all regions.What actually happened?
Environment
1.116.0monocdk 1.102.0v14.17.4Other
This is 🐛 Bug Report