2

I am trying to access values stored in aws-ssm parameter store with my mobile application based on android.

There is support in android for nearly every aws service, but not for aws-ssm.

https://aws-amplify.github.io/aws-sdk-android/docs/reference/index.html

In the java library there is already a sub library for ssm:

https://github.com/aws/aws-sdk-java/tree/master/aws-java-sdk-ssm

But that does not really help me.

I would appreciate any help on this.

GC268DM
  • 403
  • 7
  • 15
  • Did you ever get a better answer to this other than importing the Java classes into your project (which then forces you to maintain them as updates are made)? – Thomas Sunderland Apr 08 '20 at 15:25
  • @ThomasSunderland no, sadly not. Unfortunately, the Android AWS SDK supports much less functionality than the Java AWS SDK. I am not sure about their roadmap, but I hope they add support for ssm too at some point. For now we are still using the approach to import the Java classes which is working out well so far. – GC268DM Apr 10 '20 at 04:27
  • 1
    Thanks for following up on this. I opened an issue with them here: https://github.com/aws-amplify/aws-sdk-android/issues/1548 - In the meantime, I have gotten it to work by going directly to the service over HTTP which I think may be slightly preferable over having to import all of the java classes. – Thomas Sunderland Apr 11 '20 at 21:00
  • A note worth mentioning for anyone who happens upon this: Cognito unauth credentials do not work for SSM (as of now). You'll get a 403 (AccessDeniedException). I ran into this when porting the Java SDK implementation of SSM and thought I had done something wrong, but when I hit it again going over HTTP I looked deeper and found this in the documentation (shows which services Cognito Unauth has access to): https://docs.aws.amazon.com/cognito/latest/developerguide/iam-roles.html#access-policies - you'll need an IAM user instead. This may be why the AWS Android SDK does not support this service. – Thomas Sunderland Apr 14 '20 at 20:52

1 Answers1

0

We got this to work by creating a new library for our project by ourselves, which imported the java classes and we modified them to work with android.

Project Screenshot Android Studio

In the main app in the build.gradle file

implementation project(':aws-android-sdk-ssm')

and the build.gradle of that library

apply plugin: 'com.android.library'

android {
    compileSdkVersion project.ext.compileSdkVersion
    defaultConfig {
        minSdkVersion project.ext.minSdkVersion
        targetSdkVersion project.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles 'consumer-rules.pro'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.amazonaws:aws-android-sdk-core:2.13.4'

    testImplementation 'junit:junit:4.12'

    androidTestImplementation 'androidx.test:core:1.2.0'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test:rules:1.2.0'

    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
}
GC268DM
  • 403
  • 7
  • 15