Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run aws_public_ips #5

Closed
vr00n opened this issue May 15, 2018 · 15 comments
Closed

Unable to run aws_public_ips #5

vr00n opened this issue May 15, 2018 · 15 comments

Comments

@vr00n
Copy link

vr00n commented May 15, 2018

Hi there.

I do a gem install but then unable to run the actual command. Am i missing something?

Thank you

@arkadiyt
Copy link
Owner

Can you please provide some error output?

@vr00n
Copy link
Author

vr00n commented May 15, 2018

Hey @arkadiyt . Here you go.

sudo gem install aws_public_ips
Successfully installed aws_public_ips-1.0.0
$ aws_public_ips
-bash: aws_public_ips: command not found

I have confirmed that my gem directory is in my bash PATH.

@arkadiyt
Copy link
Owner

@vr00n this was a silly oversight on my part. I believe it should be fixed in the newly pushed 1.0.1 version - can you let me know if it's working now?

@vr00n
Copy link
Author

vr00n commented May 15, 2018

Thanks. It is executable now but now errors with

$ aws_public_ips --help
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/aws_public_ips-1.0.1/bin/aws_public_ips:6:in `<top (required)>'
	from /usr/local/bin/aws_public_ips:22:in `load'
	from /usr/local/bin/aws_public_ips:22:in `<main>'

@arkadiyt
Copy link
Owner

arkadiyt commented May 15, 2018

Thanks for your patience - I believe this issue should now also be resolved in 1.0.2. It's rare to see an environment without bundler installed so it didn't come up in my testing

@vr00n
Copy link
Author

vr00n commented May 16, 2018

Thanks for your response @arkadiyt . I have to mention that I run saml2aws to manage multiple managed accounts. Now I receive this error :(

$ aws_public_ips -v
#<Aws::APIGateway::Errors::UnrecognizedClientException: The security token included in the request is invalid.>
/Library/Ruby/Gems/2.3.0/gems/aws-sdk-core-3.18.0/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call'
/Library/Ruby/Gems/2.3.0/gems/aws-sdk-core-3.18.0/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in `call'
/Library/Ruby/Gems/2.3.0/gems/aws-sdk-core-3.18.0/lib/aws-sdk-core/plugins/idempotency_token.rb:17:in `call'
/Library/Ruby/Gems/2.3.0/gems/aws-sdk-core-3.18.0/lib/aws-sdk-core/plugins/param_converter.rb:24:in `call'
/Library/Ruby/Gems/2.3.0/gems/aws-sdk-core-3.18.0/lib/aws-sdk-core/plugins/response_paging.rb:10:in `call'
/Library/Ruby/Gems/2.3.0/gems/aws-sdk-core-3.18.0/lib/seahorse/client/plugins/response_target.rb:23:in `call'
/Library/Ruby/Gems/2.3.0/gems/aws-sdk-core-3.18.0/lib/seahorse/client/request.rb:70:in `send_request'
/Library/Ruby/Gems/2.3.0/gems/aws-sdk-apigateway-1.10.0/lib/aws-sdk-apigateway/client.rb:3533:in `get_rest_apis'
/Library/Ruby/Gems/2.3.0/gems/aws_public_ips-1.0.2/lib/aws_public_ips/checks/apigateway.rb:16:in `run'
/Library/Ruby/Gems/2.3.0/gems/aws_public_ips-1.0.2/lib/aws_public_ips/cli.rb:85:in `check_service'
/Library/Ruby/Gems/2.3.0/gems/aws_public_ips-1.0.2/lib/aws_public_ips/cli.rb:99:in `block in run'
/Library/Ruby/Gems/2.3.0/gems/aws_public_ips-1.0.2/lib/aws_public_ips/cli.rb:98:in `map'
/Library/Ruby/Gems/2.3.0/gems/aws_public_ips-1.0.2/lib/aws_public_ips/cli.rb:98:in `run'
/Library/Ruby/Gems/2.3.0/gems/aws_public_ips-1.0.2/bin/aws_public_ips:7:in `<top (required)>'
/usr/local/bin/aws_public_ips:22:in `load'
/usr/local/bin/aws_public_ips:22:in `<main>'

@arkadiyt
Copy link
Owner

If it's this tool:
https://github.com/Versent/saml2aws

It says in the docs:

Save these credentials to an aws profile named "saml"

So I think you should be able to get this working with:

AWS_PROFILE=saml aws_public_ips

@vr00n
Copy link
Author

vr00n commented May 16, 2018

hmm my AWS_PROFILE is already saying but still get the token error

AWS_PROFILE=saml aws_public_ips
#<Aws::APIGateway::Errors::UnrecognizedClientException: The security token included in the request is invalid.>

@arkadiyt
Copy link
Owner

But those credentials are valid for other uses? Do you get successful output from the aws cli if you run:

$ AWS_PROFILE=saml aws sts get-caller-identity

@vr00n
Copy link
Author

vr00n commented May 16, 2018

Yes when I run aws s3 ls --profile prod - it works.
FYI This time the token is expired. Before it was invalid.

$ AWS_PROFILE=saml aws sts get-caller-identity

An error occurred (ExpiredToken) when calling the GetCallerIdentity operation: The security token included in the request is expired

@arkadiyt
Copy link
Owner

arkadiyt commented May 16, 2018

You're using 2 different profiles there, prod and saml.

  1. Does aws_public_ips work with your prod profile?
$ AWS_PROFILE=prod aws_public_ips
  1. With this new "expired" error, can you now run aws_public_ips with the saml profile?
$ saml2aws login
$ AWS_PROFILE=saml aws_public_ips

@vr00n
Copy link
Author

vr00n commented May 16, 2018

Ok something seems to have worked. When I ran AWS_PROFILE=prod aws_public_ips - it returned a bunch of IPs. I then tried this and error :(

$ aws_public_ips -s .
#<ArgumentError: Invalid service(s): .>
/Library/Ruby/Gems/2.3.0/gems/aws_public_ips-1.0.2/lib/aws_public_ips/cli.rb:105:in `rescue in run': undefined method `[]' for nil:NilClass (NoMethodError)
	from /Library/Ruby/Gems/2.3.0/gems/aws_public_ips-1.0.2/lib/aws_public_ips/cli.rb:96:in `run'
	from /Library/Ruby/Gems/2.3.0/gems/aws_public_ips-1.0.2/bin/aws_public_ips:7:in `<top (required)>'
	from /usr/local/bin/aws_public_ips:22:in `load'
	from /usr/local/bin/aws_public_ips:22:in `<main>'

@arkadiyt
Copy link
Owner

arkadiyt commented May 16, 2018

That's the correct behavior - you can specify a comma separated list of services like

aws_public_ips -s ec2,elasticsearch

for instance. If you omit the parameter it checks all services. If you add the parameter and specify no services it throws an exception (because it is probably user error)

@arkadiyt
Copy link
Owner

@vr00n there was another issue resolved this morning, can you give the latest a try when you get a chance?

@arkadiyt
Copy link
Owner

@vr00n I'm going to close this out, I'm reasonably sure it's resolved. If you come back and are still seeing issues then I'm happy to re-open and continue working on it - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants