aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.82k stars 819 forks source link

Support instance profile credentials via ec2 metadata service, like aws cli #993

Closed ncknuna closed 5 years ago

ncknuna commented 5 years ago

Is your feature request related to a problem? Please describe. I'm attempting to run the amplify cli on a Jenkins worker, which gets its credentials from its instance profile, not from a ~/.aws/credentials or ~/.aws/config file. I can run aws s3 ls and other aws cli commands just fine, but when I run amplify init, it says "AWS access credentials can not be found."

Describe the solution you'd like amplify should work automagically just like the aws cli :)

Describe alternatives you've considered Per these docs I could fetch the credentials via the AWS STS API, but that's a bit of a pain.

UnleashedMind commented 5 years ago

If you've correctly setup your ~/.aws/credentials and ~/.aws/config files for role assumption, the Amplify CLI has the ability to assume the role, just like how that aws cli consumes a role from those two files. check here for a details description.

UnleashedMind commented 5 years ago

If you configured your EC2 instance to use IAM roles, the Amplify CLI can automatically assume the IAM credentials for your application, eliminating the need to manually provide credentials. This can be done in two ways:

  1. If you are initializing a project, run the amplify init in headless mode and set the awscloudformation provider's configuration level to be general, see here
  2. After you've already initialized a project (probably with other method for credentials), run amplify configure project, and when prompted Do you want to update or remove the project level configuration, select remove. The cli will then automatically assume the EC2 role for your project.
ncknuna commented 5 years ago

Ah, thanks so much for clarifying! I missed the "general" configuration level setting. Marking this closed :)

obijan42 commented 5 years ago

All the links specified above to resolve this are broken. This is a requirement for Cloud9 setups.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.