我正在尝试从S3公共存储桶访问一个对象,但是在执行我的Cfn-init帮助程序脚本时我遇到了以下错误:
ConnectionError Traceback(最近一次调用最后一次):文件" cfnbootstrap \ util.pyc",第162行,在_retry文件" cfnbootstrap \ util.pyc",第234行,_timeout ConnectionError :('连接已中止。',错误(10060,'连接尝试失败,因为连接方在一段时间后未正确响应,或已建立的连接因连接主机发生故障而失败)回应')"
如果我实例化RDP并在浏览器中更改代理设置,我可以访问S3存储桶。
以下是我的代码:
"Resources": {
"WebServer": {
"Type" : "AWS::EC2::Instance",
"Metadata": {
"AWS::CloudFormation::Authentication": {
"S3AccessCreds": {
"type": "S3",
"roleName": "sit-test-user",
"buckets" : ["sit-test-bucket"]
}
},
"AWS::CloudFormation::Init": {
"config": {
"sources": {
"c:\\S3\\xxxx" : "https://s3-ap-southeast-2.amazonaws.com/xxxxxxx/xxxxxx.ps1"
}
}
}
},
"UserData" : {
"Fn::Base64" : {
"Fn::Join" : ["", [
"<script>\n",
"cfn-init.exe -s ",
{"Ref" : "AWS::StackId"},
" -r WebServer --region ",
{"Ref" : "AWS::Region"},
" --http-proxy http://proxy.aws.xxxxxx.local:8080 \n",
"</script>\n"
]]
}
}
答案 0 :(得分:0)
我遇到相同的错误,直到相同的错误行号。就我而言,我是将实例启动到专用子网中,然后尝试在UserData中执行各种配置命令并从S3(无VPC端点)下载。但是,我的子网没有通往Internet的路由。为了解决这个问题,我做到了:
import 'dart:async'; import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; void main() => runApp(App()); class App extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Demo', theme: ThemeData( primarySwatch: Colors.green, ), initialRoute: '/', routes: <String, WidgetBuilder>{ '/': (BuildContext context) => MyWidget(), }, ); } } class MyWidget extends StatefulWidget { MyWidget({Key key}) : super(key: key); final String title = "Demo"; @override _State createState() => _State(); } class _State extends State<MyWidget> { List<String> _items = []; Future<Null> getData(String searchTerm) async { final entriesToAdd = render(searchTerm); setState(() { _items = entriesToAdd; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: TextField( onSubmitted: getData, decoration: InputDecoration(hintText: 'Search', icon: Icon(Icons.search)), ), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Expanded( child: ListView.builder( itemCount: _items.length, itemBuilder: (context, index) { return Container( padding: EdgeInsets.all(8.0), child: Entry(data: _items[index])); })), ], ), )); } } class Entry extends StatefulWidget { Entry({Key key, @required this.data}) : super(key: key); final String data; @override _EntryState createState() => _EntryState(data); } class _EntryState extends State<Entry> { _EntryState(this.data) : super(); final String data; @override Widget build(BuildContext context) { return Text(data); } } List<String> render(String searchTerm) { final Random rng = new Random(); final String date = DateTime.now().toString(); return List<String>.generate( rng.nextInt(10), (int i) => '$searchTerm $i $date', ); }
AssocANat: Type: 'AWS::EC2::SubnetRouteTableAssociation' DependsOn: - SubnetA - RouteTableNATGatewayA Properties: RouteTableId: !Ref RouteTableNATGatewayA SubnetId: !Ref SubnetA