kislyuk / aegea

Amazon Web Services Operator Interface
Apache License 2.0
68 stars 17 forks source link

Fix IAM eventual consistency #2

Open kislyuk opened 8 years ago

kislyuk commented 8 years ago
kislyuk@Aurora:~/projects/aegea>aegea launch aktest4 --duration-hours 5
INFO:tweak:Loaded configuration from /Users/kislyuk/.config/aegea/config.yml
INFO:botocore.credentials:Found credentials in shared credentials file: ~/.aws/credentials
INFO:boto3.resources.collection:Calling ec2:describe_key_pairs with {}
INFO:boto3.resources.collection:Calling ec2:describe_images with {'Owners': ['self'], 'Filters': [{'Name': 'state', 'Values': ['available']}]}
INFO:boto3.resources.collection:Calling ec2:describe_vpcs with {'Filters': [{'Name': 'isDefault', 'Values': ['true']}]}
INFO:boto3.resources.collection:Calling ec2:describe_subnets with {'Filters': [{'Name': 'vpc-id', 'Values': ['vpc-bc9b15d7']}]}
INFO:boto3.resources.collection:Calling ec2:describe_security_groups with {'GroupNames': ['aegea.launch'], 'Filters': [{'Name': 'vpc-id', 'Values': ['vpc-bc9b15d7']}]}
INFO:boto3.resources.collection:Calling paginated iam:list_instance_profiles with {}
INFO:boto3.resources.collection:Calling paginated iam:list_roles with {}
INFO:boto3.resources.action:Calling iam:attach_role_policy with {'RoleName': 'aegea.launch', 'PolicyArn': 'arn:aws:iam::aws:policy/IAMReadOnlyAccess'}
INFO:boto3.resources.action:Calling iam:attach_role_policy with {'RoleName': 'aegea.launch', 'PolicyArn': 'arn:aws:iam::aws:policy/AmazonElasticFileSystemFullAccess'}
INFO:boto3.resources.collection:Calling paginated iam:list_roles with {}
INFO:boto3.resources.action:Calling iam:create_role with {'RoleName': 'SpotFleet', 'AssumeRolePolicyDocument': '{"Version": "2012-10-17", "Statement": [{"Action": ["sts:AssumeRole"], "Principal": {"Service": "spotfleet.amazonaws.com"}, "Effect": "Allow"}]}'}
INFO:boto3.resources.action:Calling iam:attach_role_policy with {'RoleName': 'SpotFleet', 'PolicyArn': 'arn:aws:iam::aws:policy/service-role/AmazonEC2SpotFleetRole'}
INFO:boto3.resources.action:Calling iam:get_role with {'RoleName': 'SpotFleet'}
INFO:aegea:Launching <aegea.util.aws.SpotFleetBuilder object at 0x109c1e438: {'cores': 1, 'dry_run': False, 'gpus_per_instance': 0, 'iam_fleet_role': iam.Role(name='SpotFleet'), ...}>
Traceback (most recent call last):
  File "/usr/local/bin/aegea", line 24, in <module>
    args.entry_point(args)
  File "/Users/kislyuk/projects/aegea/aegea/launch.py", line 117, in launch
    expect_error_codes(e, "DryRunOperation")
  File "/Users/kislyuk/projects/aegea/aegea/launch.py", line 96, in launch
    sfr_id = spot_fleet_builder(ec2.meta.client)
  File "/Users/kislyuk/projects/aegea/aegea/util/aws.py", line 351, in __call__
    res = client.request_spot_fleet(DryRun=self.dry_run, SpotFleetRequestConfig=self.spot_fleet_request_config, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/botocore/client.py", line 228, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.5/site-packages/botocore/client.py", line 492, in _make_api_call
    raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidSpotFleetRequestConfig) when calling the RequestSpotFleet operation: Parameter: SpotFleetRequestConfig.IamFleetRole is invalid.