Skip to content

Device Farm - Appium Web Node - is it possible to grant access to a secret in Secrets Manager?

0

I've created an appium test for our web app, and I'm running it on ios devices in device farm. I would like to use the javascript aws-sdk to connect to secrets manager, where i'll store test user credentials. Documentation makes it seem like private devices could leverage service-linked roles to do this, I'm not clear whether or not this could be done with devices from the public pool. Is there a way that I could grant permissions to device farm to access a specific secret in secrets manager?

1 Answer
0
const AWS = require('aws-sdk');
const lambda = new AWS.Lambda({ region: 'your-region' });

async function getSecret() {
    const params = {
        FunctionName: 'YourLambdaFunctionName',
        InvocationType: 'RequestResponse',
    };
    try {
        const result = await lambda.invoke(params).promise();
        return JSON.parse(result.Payload.toString());
    } catch (error) {
        console.error('Error getting secret:', error);
        throw error;
    }
}

// Use this in your test
(async () => {
    const secret = await getSecret();
    // Use secret here
})();

answered 2 years ago

  • Thanks Hikaru, my question isn't really about how to use the aws-sdk, as much as how to grant the running test permissions to invoke lambdas or retrieve secrets. Does the test execute using an aws role? If so, what is the role and how do I grant it access to a lambda or secret?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.