AWS / CDK:如何创建具有CfnEIPA关联的ARecord Target?

时间:2020-07-17 13:28:44

标签: amazon-ec2 aws-cdk cdk

对于新分配的IP,在C#中将是这样(使用 .Ref ):

var arNewPublic = new ARecord(this, $"ARecord_Public_NewAlloc", new ARecordProps
{
  ...
  Target = RecordTarget.FromValues(newElasticIPs.Select(eip => eip.Ref).ToArray())
  ...

但是如何为CfnEIPAssociation创建ARecord目标?

这样做:

Target = RecordTarget.FromValues(elasticIPAssociations.Select(eipa => eipa.Eip).ToArray()),

抛出:

未处理的异常。 Amazon.JSII.Runtime.JsiiException: 对于{“ name”:“ values”,“ type”:{“ primitive”:“ string”},“ variadic”:true}

的非可选实例,得到“未定义”

或使CF部署崩溃:

Target = RecordTarget.FromValues(elasticIPAssociations.Select(eipa => eipa.Ref).ToArray()),

9/12 |下午1:58:11 | CREATE_FAILED | AWS :: Route53 :: RecordSet | ARecord-Public-PreAlloc(ARecordPublicPreAllocCB385358)[无效的资源记录:致命问题:'eipassoc-0f9299c9975d21e6e'遇到的ARRDATAIllegalIPv4Address(值不是有效的IPv4地址)] 新的RecordSet(... @ aws-cdk \ aws-route53 \ lib \ record-set.js:134:27)

0 个答案:

没有答案