question

Norbert Gocht avatar image
Norbert Gocht asked

Ask cli does not use region setting from aws config ?

I did setup the ask-cli , but I did notice it is not using the regions settings from aws config. So API calls for ask lambda access us-east instead of eu-west.

Is this a bug or did I miss a configuration option.

lambda
10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Peter@AMZN avatar image
Peter@AMZN answered

Hello,

Thank you for reporting this.

For region-specific endpoints, the CLI will deploy Lambda functions to the closest AWS region (us-east-1 for skillManifest.apis.custom.regions.NA.endpoint, eu-west-1 for skillManifest.apis.custom.regions.EU.endpoint). For the global default endpoint (skillManifest.apis.custom.endpoint) it currently deploys to us-east-1 by default. We're looking at changing this behavior to use the region setting in ~/.aws/config file. For now, you can change the endpoint to be an EU-specific endpoint (in both skill.json and .ask/config) before deploying to work around this.

Thanks again,

Peter

1 comment
10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sorry for wasting your time but could you specify how a region change in ~/.ask/cli_config should look?

This is my ~/.ask/cli_config

{

"profiles": {

"default": {

"aws_profile": "default",

"token": {

"access_token": "My_access_token",

"refresh_token": "My_refresh_token",

"token_type": "bearer",

"expires_in": 3600,

"expires_at": "2017-10-06T14:12:26.171Z"

},

"vendor_id": "My_vendor_id"

}

}

}

This is my skill.json, that i get when i call: ask api get-skill -s skill_id > skill.json

{

"skillManifest": {

"publishingInformation": {

"locales": {

"en-GB": {

"name": "My Skill"

}

},

"isAvailableWorldwide": true,

"category": "PUBLIC_TRANSPORTATION",

"distributionCountries": []

},

"apis": {

"custom": {

"endpoint": {

"uri": "arn:aws:lambda:eu-west-1:123456789:function:MySkill"

},

"interfaces": []

}

},

"manifestVersion": "1.0"

}

}

As you may have guessed, "ask api ..." works fine and uses the correct region. But when I call "ask lambda download -f MySkill" I get the error:

ResourceNotFoundException: Function not found: arn:aws:lambda:us-east-1:123456789:function:MySkill

So should I add a region field to my cli_config and how would it look exactly? Thanks for your time.

0 Likes 0 ·
newuser-03ef7ae8-a1e5-49f3-b358-63ba748141a3 avatar image
newuser-03ef7ae8-a1e5-49f3-b358-63ba748141a3 answered

I also have this problem, the ask-cli doesn't seem to be using the region from the associated profile therefore I can't manage lambda functions using it.

10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

uzinabobina avatar image
uzinabobina answered

Dear Amazon Team,

Given that multiple Alexa developers have this problem and Peter@AMZN already acknowledged this is a bug, can you please provide the steps to overcome this issue ? We are all trying to decipher what Peter might have meant with his cryptical message above, but with no luck.

Peter mentioned changing the endpoint to an EU specific endpoint in both skill.json and .ask/config. And here is what I did, but still no success.

I changed the contents of my skill's skill.json from

"apis": { "custom": { "endpoint": { "sourceDir": "lambda/custom" } } }

into

"apis": { "custom": { "regions": { "EU": { "endpoint": { "sourceDir": "lambda/custom" } } } } }

And I also changed the contents of my skill's /.ask/config file from:

"apis": { "custom": { "endpoint": {

"sourceDir": "lambda/custom" } } }

into:

"apis": { "custom": { "regions": {

"EU": {

"endpoint": {

"sourceDir": "lambda/custom" } } } } }

And now, when I try to use ASK CLI to deploy my skill, I get this error:

[Error]: Invalid skill information. Please check skill.json against `.ask/config`. The "merge" object inside the config file will overwrite the existing field in skill.json at runtime.

Any other suggestions ?

10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ManAnRuck avatar image
ManAnRuck answered

for me it works if I edit the following file:

~/.aws/credentials (Linux, macOS, or Unix)

C:\Users\USERNAME\.aws\credentials (Windows)

[ask_cli_default]
aws_access_key_id=YOUR_AWS_ACCESS_KEY
aws_secret_access_key=YOUR_AWS_SECRET_KEY
region=eu-west-1
1 comment
10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

This worked for me as well. I may have accidentally done the default region when running ask init.

0 Likes 0 ·