Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

AWS: Assume Roles #68

Open
stourwalk-work opened this issue Sep 19, 2019 · 3 comments
Open

AWS: Assume Roles #68

stourwalk-work opened this issue Sep 19, 2019 · 3 comments

Comments

@stourwalk-work
Copy link

I'm trying to use the s3-storage-wagon with ARN profile support as mandated by my corporate environment and am struggling to get it to work via mvn.

All the credentials are configured and I can do a aws s3 ls mybucket or aws s3 cp file.txt mybucket and it works perfectly, but I consistently get "Unable to find a region via the region provider chain. " from maven.

I have AWS_PROFILE, AWS_DEFAULT_REGION and the other AWS key variables set in my bash profile and .aws/credentials. The is also set in the section of s3-upload

That I have to use a profile is the only reason I can think that the upload is failing

@gkatzioura
Copy link
Owner

Please try to do

AWS_DEFAULT_REGION=your-region AWS_ACCESS_KEY_ID=access_key AWS_SECRET_ACCESS_KEY=secret_key mvn clean deploy

or through your settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0                         https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server>
      <id>repo-id</id>
      <username>access_key</username>
      <password>secret_key</password>
      <configuration>
        <region>eu-west-2</region>
      </configuration>
    </server>
  </servers>
</settings>

@stourwalk-work
Copy link
Author

I have those entries in my settings.xml and also in my environment.
Maven is normally run through eclipse (and I've also added the Environment Vars to the Environment section of the Run Configuration as well)
I've also got AWS_PROFILE={profilename} and the corresponding [profilename] section in my .aws/credentials file

From the command line I still get
[ERROR] Failed to execute goal com.gkatzioura.maven.cloud:s3-storage-wagon:2.1:s3-upload (upload-jar) on project RaaS: Execution upload-jar of goal com.gkatzioura.maven.cloud:s3-storage-wagon:2.1:s3-upload failed: Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region. -> [Help 1]

credentials
`[default]
aws_access_key_id=access_key
aws_secret_access_key=secret
region=us-east-1
output=json

[raas2prod]
role_arn=arn:aws:iam::nnnnnnnn:role/managed-role/rolename
source_profile=default`

@pjroth
Copy link

pjroth commented Feb 13, 2020

@stourwalk-work you might need to provide the region in raas2prod profile in your ~/.aws/credentials file.

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

No branches or pull requests

3 participants