2016-07-23 15 views
0

私はVPCで単一のインスタンスをデプロイするCloudFormationスクリプトを持っています。 このスクリプトは、インスタンスにパブリックIPがある場合にのみ機能します。パブリックIPアドレスがないと、WaitConditionステージでテンプレートの展開が失敗します。 WaitConditionはインスタンスがインターネットにアクセスする必要があるので、私はそれを推測する?CloudFormation WaitConditionにパブリックアクセスが必要

パブリックIPを割り当てるのではなく、サーバーにプロキシアドレスを設定すると機能しますか?したがって、インスタンスはWebプロキシ経由でインターネットにアクセスします。その場合、Web URLはプロキシでホワイトリストに登録する必要がありますか?私はuserdataにadd proxy addressコマンドを追加できますか? CFN-signal.exeをするためにこれらのパラメータの上で追加することにより、プロキシで

"Mappings": { 
    "AWSRegion2AMI": { 
     "ap-southeast-2": { 
     "Windows2008r2": "ami-27b39a44", 
     "Windows2012r2": "ami-83b198e0" 
     } 
    } 

    }, 

    "Resources": { 
    "DomainController": { 
     "Type": "AWS::EC2::Instance", 
     "Metadata": { 
     "AWS::CloudFormation::Init": { 
      "config": { 
      "files": { 
       "c:\\cfn\\cfn-hup.conf": { 
       "content": { 
        "Fn::Join": ["", [ 
        "[main]\n", 
        "stack=", { 
         "Ref": "AWS::StackId" 
        }, "\n", 
        "region=", { 
         "Ref": "AWS::Region" 
        }, "\n" 
        ]] 
       } 
       }, 

       "c:\\cfn\\hooks.d\\cfn-auto-reloader.conf": { 
       "content": { 
        "Fn::Join": ["", [ 
        "[cfn-auto-reloader-hook]\n", 
        "triggers=post.update\n", 
        "path=Resources.DomainController.Metadata.AWS::CloudFormation::Init\n", 
        "action=cfn-init.exe -v -s ", { 
         "Ref": "AWS::StackId" 
        }, 
        " -r DomainController", 
        " --region ", { 
         "Ref": "AWS::Region" 
        }, "\n" 
        ]] 
       } 
       }, 

       "C:\\cfn\\RunCommand.bat": { 
       "content": "%~1\nIF %ERRORLEVEL% GTR 10 (exit /b 1) else (exit /b 0)" 
       } 
      }, 

      "commands": { 
       "1-run-dcpromo": { 
       "command": { 
        "Fn::Join": ["", [ 
        "C:\\cfn\\RunCommand.bat \"dcpromo /unattend /ReplicaOrNewDomain:Domain /NewDomain:Forest /NewDomainDNSName:", { 
         "Ref": "DomainDNSName" 
        }, 
        " /ForestLevel:4 /DomainNetbiosName:", { 
         "Ref": "DomainNetBIOSName" 
        }, 
        " /DomainLevel:4 /InstallDNS:Yes /ConfirmGc:Yes /CreateDNSDelegation:No /DatabasePath:\"C:\\Windows\\NTDS\" /LogPath:\"C:\\Windows\\NTDS\" /SYSVOLPath:\"C:\\Windows\\SYSVOL\" /SafeModeAdminPassword=", { 
         "Ref": "RestoreModePassword" 
        }, 
        " /RebootOnCompletion:Yes\"" 
        ]] 
       }, 
       "waitAfterCompletion": "forever" 
       }, 
       "2-signal-success": { 
       "command": { 
        "Fn::Join": ["", [ 
        "cfn-signal.exe -e 0 \"", { 
         "Fn::Base64": { 
         "Ref": "DomainControllerWaitHandle" 
         } 
        }, "\"" 
        ]] 
       } 
       } 
      }, 

      "services": { 
       "windows": { 
       "cfn-hup": { 
        "enabled": "true", 
        "ensureRunning": "true", 
        "files": ["c:\\cfn\\cfn-hup.conf", "c:\\cfn\\hooks.d\\cfn-auto-reloader.conf"] 
       } 
       } 
      } 
      } 
     } 
     }, 

     "Properties": { 
     "ImageId": { 
      "Fn::FindInMap": ["AWSRegion2AMI", { 
      "Ref": "AWS::Region" 
      }, "Windows2008r2"] 
     }, 
     "InstanceType": { 
      "Ref": "InstanceType" 
     }, 
     "NetworkInterfaces": [{ 
      "AssociatePublicIpAddress": "false", 
      "DeviceIndex": "0", 
      "SubnetId": { 
      "Ref": "SubnetId" 
      } 
     }], 

     "KeyName": { 
      "Ref": "KeyName" 
     }, 

     "UserData": { 
      "Fn::Base64": { 
      "Fn::Join": ["", [ 
       "<script>\n", 

       "cfn-init.exe -v -s ", { 
       "Ref": "AWS::StackId" 
       }, 
       " -r DomainController ", 
       " --region ", { 
       "Ref": "AWS::Region" 
       }, "\n", 

       "</script>" 
      ]] 
      } 
     } 
     } 
    }, 

    "DomainControllerWaitCondition": { 
     "Type": "AWS::CloudFormation::WaitCondition", 
     "DependsOn": "DomainController", 
     "Properties": { 
     "Handle": { 
      "Ref": "DomainControllerWaitHandle" 
     }, 
     "Timeout": "1500" 
     } 
    }, 

    "DomainControllerWaitHandle": { 
     "Type": "AWS::CloudFormation::WaitConditionHandle" 
    } 

答えて

0

パス:

--http-proxy 
An HTTP proxy (non-SSL). Use the following format: http://user:[email protected]:port 

--https-proxy 
An HTTPS proxy. Use the following format: https://user:[email protected]:port 

信号がS3バケットに送信され

以下は私のテンプレートです。

https://cloudformation-waitcondition-*.s3.amazonaws.com 

注:あなたのような何かをホワイトリストに登録することができます。また、プライベートサブネット内のリソースは、S3へのアクセスを許可するS3 VPCエンドポイント機能を使用することができます。 http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-endpoints.html

関連する問題