【问题标题】:Why is AWS EC2 not working on iOS and MacOS?为什么 AWS EC2 不能在 iOS 和 MacOS 上运行?
【发布时间】:2020-08-07 11:06:25
【问题描述】:

所以基本上我正在编写一个用于管理一些 EC2 实例的工具,没什么特别的。 我设法为 MacOS 构建了一些 AWS 框架(令人难以置信的是它不受官方支持),我现在正在尝试使用该框架的 describeInstances() 请求。

我总是遇到同样的错误:Domain=com.amazonaws.AWSEC2ErrorDomain Code=0

  • 我在 iOS 上尝试过同样的代码,同样的问题。
  • 我在 python 脚本上尝试过,使用 Boto3 库,这里没问题,函数返回我的实例和描述。
  • 我已经在同一个 MacOS 项目上使用 AWSS3 和 AWSSNS,没有问题。
  • 我在 IAM 上设置了我的策略,而 EC2 设置为“fullAccess”

代码如下:

    AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc]
                                                         initWithRegionType:AWSRegionUSEast1
                                                          identityPoolId:kPoolID];

    AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1 credentialsProvider:credentialsProvider];

    [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;

    AWSEC2 *ec2 = [AWSEC2 defaultEC2];

    AWSEC2DescribeInstancesRequest *request = [AWSEC2DescribeInstancesRequest new];
    [ec2 describeInstances:request completionHandler:^(AWSEC2DescribeInstancesResult * _Nullable response, NSError * _Nullable error) {
        if(error){
            NSLog(@"%@ = %@", @"EC2 describe Error", error);
        }else{
            NSLog(@"%@ = %@", @"EC2 describe Response", response);
        }
    }];

谁能帮我解决这个问题?

【问题讨论】:

    标签: ios objective-c macos amazon-web-services amazon-ec2


    【解决方案1】:

    由于某种原因,EC2 不想将认知池作为一种身份验证形式,我必须使用访问权限和密钥进行连接才能使其正常工作。

    【讨论】:

      猜你喜欢
      • 2020-05-22
      • 2020-12-03
      • 1970-01-01
      • 2022-07-26
      • 2014-10-31
      • 1970-01-01
      • 2019-05-27
      • 2013-09-05
      • 2015-01-22
      相关资源
      最近更新 更多