wallix / awless

A Mighty CLI for AWS
http://awless.io/
Apache License 2.0
4.98k stars 263 forks source link

error when using pricer #155

Open varunchandak opened 6 years ago

varunchandak commented 6 years ago

facing this issue whenever I use pricer:

$ awless -p PROFILE -r ap-south-1 inspect -i pricer
[error]   unmarshalling property 'Role' of resource 'i-0d0e5ddcXXXXXXXXX': get property 'cloud:role': '{isLit:true isBnode:false resource: bnode: lit:{typ:xsd:string val:/dev/sda1 langtag:}}' object not resource identifier
fxaguessy commented 6 years ago

Hi, thanks for reporting. You may have an old local model.

Please also note that pricer and all inspectors are, for now, proof-of-concepts of what we can do with awless graph model, rather than reliable source of information. You should take the results of the inspectors with care.

varunchandak commented 6 years ago
$ awless version
awless version=v0.1.5, commit=21a3a94174dfe7033ce760f050c187637100d22e, build-date=2017-10-05T15:04:43+02:00, build-arch=amd64, build-os=darwin, build-for=brew

Output of the command awless sync -e -r ap-south-1 :

$ awless sync -e -r ap-south-1 -p XXXXXX
[verbose] awless v0.1.5 - loading AWS session with profile 'XXXXXX' and region 'ap-south-1'
[info]    running sync for region 'ap-south-1'
[verbose] sync: *disabled* for service monitoring
[verbose] sync: *disabled* for resource storage[s3object]
[extra]   sync: fetched cloudformation service took 538.175382ms
[extra]   sync: fetched messaging service took 586.070493ms
[extra]   sync: fetched lambda service took 625.224268ms
[extra]   sync: fetched storage service took 1.339128926s
[extra]   sync: fetched cdn service took 1.656703465s
[extra]   sync: fetched dns service took 2.575089669s
[extra]   sync: fetched access service took 17.503271383s
[verbose] syncing errors:
        syncing infra: RequestError: send request failed
caused by: Post https://ecs.ap-south-1.amazonaws.com/: dial tcp: lookup ecs.ap-south-1.amazonaws.com: no such host
RequestError: send request failed
caused by: Post https://ecs.ap-south-1.amazonaws.com/: dial tcp: lookup ecs.ap-south-1.amazonaws.com: no such host
RequestError: send request failed
caused by: Post https://ecs.ap-south-1.amazonaws.com/: dial tcp: lookup ecs.ap-south-1.amazonaws.com: no such host
RequestError: send request failed
caused by: Post https://ecs.ap-south-1.amazonaws.com/: dial tcp: lookup ecs.ap-south-1.amazonaws.com: no such host
RequestError: send request failed
caused by: Post https://ecr.ap-south-1.amazonaws.com/: dial tcp: lookup ecr.ap-south-1.amazonaws.com: no such host
[info]    -> lambda: 26 functions
[info]    -> infra: 1 vpc, 0 importimagetask, 0 launchconfiguration, 0 repository, 0 containertask, 1 routetable, 0 listener, 22 volumes, 1 internetgateway, 2 availabilityzones, 0 container, 1 certificate, 13 instances, 3 subnets, 18 images, 15 networkinterfaces, 0 targetgroup, 0 loadbalancer, 0 scalinggroup, 0 containerinstance, 17 keypairs, 1 dbsubnetgroup, 66 securitygroups, 5 elasticips, 1 database, 0 containercluster, 0 natgateway, 154 snapshots, 0 scalingpolicy
[info]    -> storage: 0 s3object, 32 buckets
[info]    -> cdn: 10 distributions
[info]    -> dns: 7 zones, 31 records
[info]    -> access: 97 policies, 10 mfadevices, 125 roles, 34 accesskeys, 41 users, 12 groups, 20 instanceprofiles
[info]    -> cloudformation: 12 stacks
[info]    -> messaging: 5 subscriptions, 0 queue, 6 topics
[info]    sync took 17.900014153s

However, when i run on linux instance with role based access:

# awless inspect -i pricer
[info]    Running full sync before inspection (disable it with --local flag)

Fetching prices at http://ec2-price.com for region ap-south-1

Instance    Count   Estimated total/day (no EBS)
--------    -----   ----------------------------
c4.4xlarge  1
t2.micro    4
t2.large    6
m4.large    1
            $42.00

awless version: awless version=v0.1.5, commit=21a3a94174dfe7033ce760f050c187637100d22e, build-date=2017-10-05T14:56:19+02:00, build-arch=amd64, build-os=linux, build-for=targz

fxaguessy commented 6 years ago

Thanks for your response. Is instance i-0d0e5ddcXXXXXXXXX in region ap-south-1 ?

This bug might be because the pricer inspector loads data from all regions (even if it should not) and perhaps this instance is in a region that has not been synced for a long time and contains properties that are no longer valid.

varunchandak commented 6 years ago

Yup.

And the instance is a fresh one and still in existence. The output for the same instance differs on linux and OSX.

fxaguessy commented 6 years ago

The output for the same instance differs on linux and OSX.

This is strange. Are you talking about the output of awless show i-0d0e5ddcXXXXXXXXX ? Could you please paste here the (anonymized) output of the command on both platforms ?

varunchandak commented 6 years ago

No, the output for pricer differs. On Mac, it's error but on linux, it's working.

Pricer Output: Linux:

# awless inspect -i pricer
[info]    Running full sync before inspection (disable it with --local flag)

Fetching prices at http://ec2-price.com for region ap-south-1

Instance    Count   Estimated total/day (no EBS)
--------    -----   ----------------------------
m4.large    1
t2.large    6
t2.micro    5
c4.4xlarge  1
            $42.34

Mac:

$ awless -p PROFILE inspect -i pricer -r ap-south-1
[info]    Running full sync before inspection (disable it with --local flag)

[error]   unmarshalling property 'Role' of resource 'i-0d0e5ddc758d125a9': get property 'cloud:role': '{isLit:true isBnode:false resource: bnode: lit:{typ:xsd:string val:/dev/sda1 langtag:}}' object not resource identifier

awless show Output: Linux:

# awless show i-0d0e5ddc758d125a9
[info]    cannot find resource in existing data synced locally
[info]    running sync for current region 'ap-south-1'
[error]   resource with reference 'i-0d0e5ddc758d125a9' not found in region ap-south-1

Mac:

$ awless -p PROFILE -r ap-south-1 show i-0d0e5ddc758d125a9
[info]    cannot find resource in existing data synced locally
[info]    running sync for current region 'ap-south-1'
[error]   unmarshalling property 'Role' of resource 'i-0d0e5ddc758d125a9': get property 'cloud:role': '{isLit:true isBnode:false resource: bnode: lit:{typ:xsd:string val:/dev/sda1 langtag:}}' object not resource identifier
varunchandak commented 6 years ago

Also, do note that on Mac I have AssumeRole permissions for aws cli (or awless) usage, whereas on Linux, I have attached a role to the instance.

fxaguessy commented 6 years ago

Thanks for the details. Are the role you are assuming on Mac and the one you are using for the Linux instance the same ? You can get the role you are using, as seen by Amazon, with awless whoami.

It looks like the Linux instance does not have access to the info of instance i-0d0e5..., whereas the Mac instance can access to this data (but, due to a bug, it can not unmarshal it properly).

varunchandak commented 6 years ago

Linux Box:

# awless whoami
ResourceType: assumed-role, Resource: cc-monitor/i-08578c4XXXXXXXXXX, Id: AROAXXXXXXXXXXXXXXXXX:i-08578c4XXXXXXXXXX, Account: 55XXXXXXXXXX

Mac Box:

$ awless whoami -p PROFILE
ResourceType: assumed-role, Resource: cc-access/15YYYYYYYYYYYYYYYYY, Id: AROAYYYYYYYYYYYYYYYYY:15YYYYYYYYYYYYYYYYY, Account: 55XXXXXXXXXX
Niemi commented 5 years ago

Hi to all, similar issue with "pricer" `aleksei@myhost:~$ awless -p PROD inspect -i pricer --local Fetching prices at http://ec2-price.com for region global

fetching price for 'c4.large': strconv.ParseFloat: parsing "\r\n502 Bad Gateway\r\n<body bgcolor=\"white\">\r\n

502 Bad Gateway

\r\n
nginx/1.6.2
\r\n\r\n\r\n": invalid syntax fetching price for 't2.small': strconv.ParseFloat: parsing "\r\n502 Bad Gateway\r\n<body bgcolor=\"white\">\r\n

502 Bad Gateway

\r\n
nginx/1.6.2
\r\n\r\n\r\n": invalid syntax fetching price for 'c4.xlarge': strconv.ParseFloat: parsing "\r\n502 Bad Gateway\r\n<body bgcolor=\"white\">\r\n

502 Bad Gateway

\r\n
nginx/1.6.2
\r\n\r\n\r\n": invalid syntax fetching price for 't2.micro': strconv.ParseFloat: parsing "\r\n502 Bad Gateway\r\n<body bgcolor=\"white\">\r\n

502 Bad Gateway

\r\n
nginx/1.6.2
\r\n\r\n\r\n": invalid syntax fetching price for 'c5.large': strconv.ParseFloat: parsing "\r\n502 Bad Gateway\r\n<body bgcolor=\"white\">\r\n

502 Bad Gateway

\r\n
nginx/1.6.2
\r\n\r\n\r\n": invalid syntax fetching price for 'm3.medium': strconv.ParseFloat: parsing "\r\n502 Bad Gateway\r\n<body bgcolor=\"white\">\r\n

502 Bad Gateway

\r\n
nginx/1.6.2
\r\n\r\n\r\n": invalid syntax fetching price for 'c5.xlarge': strconv.ParseFloat: parsing "\r\n502 Bad Gateway\r\n<body bgcolor=\"white\">\r\n

502 Bad Gateway

\r\n
nginx/1.6.2
\r\n\r\n\r\n": invalid syntax fetching price for 't2.medium': strconv.ParseFloat: parsing "\r\n502 Bad Gateway\r\n<body bgcolor=\"white\">\r\n

502 Bad Gateway

\r\n
nginx/1.6.2
\r\n\r\n\r\n": invalid syntax Instance Count Estimated total/day (no EBS)


t2.micro 4
t2.small 5
c4.large 1
c5.xlarge 2
c4.xlarge 1
m3.medium 1
t2.medium 24
c5.large 6
$0.00
aleksei@myhost~$ awless version version=v0.1.11, commit=d6094ca2f507ce9ecd8c8f8de030fbea60923ebf, build-date=2018-06-21T12:04:05+02:00, build-arch=amd64, build-os=linux, build-for=targz `

simcap commented 5 years ago

See https://github.com/wallix/awless/issues/216