question

Dennis avatar image
Dennis asked

ask-cli does not deploy to eu-west-1 or other regions as the default us-east-1

Hi,

i couldn't figure how to deploy to eu-west-1 with ask-cli. i tried it within the skills.json or with the aws config, and tried to find an answer with a git issues or in this forum.

And yes i found some questions with the same problem:

https://forums.developer.amazon.com/questions/87922/ask-cli-does-not-use-region-setting-from-aws-confi.html

https://forums.developer.amazon.com/questions/113718/ask-cli-does-not-deploy-to-eu-west-1.html

But without a helpful answer, only a couple of more questions. Or workarounds like creating a lambda function by hand.

Please tell me how it is possible to deploy a skill with ask-cli to eu-west-1.

Could you post a link for an example, a documentation or something i can reproduce.

Best Regards

Dennis

alexa skills kitlambdaask cli
10 |5000

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

Ron Wang avatar image
Ron Wang answered

Hi all!

The region for the Lambda creation right now is controlled by the region where Lambda belongs to. CLI's current logic is creating Lambda with the following mapping:

    'default' : 'us-east-1',
    'NA' : 'us-east-1',
    'EU' : 'eu-west-1',
    'IN' : 'eu-west-1',
    'FE' : 'ap-northeast-1'

So if you want to use CLI's handy advantage of creating Lambda, you will need to specify the target region in skill.json, and use the ARN created for that region.

We cannot use .aws/config's region setting for different regions because we recommend creating Lambda in the closest region. But we will definitely think about supporting the region setting in .aws/config for default region in the short term.

For example:

Supposing you only have default endpoint in your skill:

"apis": {
  "custom": {
    "endpoint": {
      "sourceDir": "lambda/custom"
    },
// Add EU region to skill.json to let next deploy create EU's Lambda.
    "regions": {
      "EU":{
        "endpoint": {
          "sourceDir": "lambda/custom"  // You can also use different codebase
        }
      },
    }
  }
}

CLI treats this case (code exists but arn not exists in skill project's .ask/config file) as creating lambda for deploy command, and this skill will create the Lambda in eu-west-1.

If you want to use it as your default option, you can replace the url for default endpoint with this newly created arn in the "merge" field. Do deploy after the modification and skill will use this newly created endpoint as default.

Thanks,

Ron

2 comments
10 |5000

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

James Meyers avatar image James Meyers commented ·

If 'NA':'us-east-1', how can I deploy to us-west-2? Why would the logic not just allow me to specify the exact region?

0 Likes 0 ·
Bob Denny avatar image Bob Denny commented ·

Same here: How us-west-2? This is all ridiculously confusing.

0 Likes 0 ·
Anand@Amazon avatar image
Anand@Amazon answered

Hello Dennis,

Thanks for reaching out to us.

Whenever you setup ask cli in your system then there are two hidden file which get generated. ASK and AWS . All your profile details like access token and refresh token will be saved in .ask/cli_config.

Access token and Access secret token will be saved in .aws/credentials. If you want to add lambda to specific region then please create config folder ~/.aws/config.

~/.aws/config

[default]
region=us-west-2
output=json
10 |5000

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

Steven Doherty avatar image
Steven Doherty answered

I have already set the above config to point to west however it still defaults to us-east-1. I have even created a new solution to test this. Is there anywhere else this is set? Thanks

1 comment
10 |5000

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

Ron Wang avatar image Ron Wang commented ·

Hi @Steven Doherty, do you still have problem setting the lambda region?

0 Likes 0 ·
RamaK avatar image
RamaK answered

Hi Anand,

I modified /aws/config as suggested by you to us-west-2 but no luck. any other way to over come this issue?

Regards,

RamaKrishna Killana

2 comments
10 |5000

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

Ron Wang avatar image Ron Wang commented ·

Hi @NewUser-9d8bb617-4982-4186-93d0-e7dbc2900c0d, does my answer solve your problem?

0 Likes 0 ·
Bob Denny avatar image Bob Denny Ron Wang commented ·

No, because there are no 2-letter choices for us-west-2 like the other commenter to your post said.

0 Likes 0 ·
newuser-f0fd3105-3800-4449-bbdd-4b76ca5b3b9e avatar image
newuser-f0fd3105-3800-4449-bbdd-4b76ca5b3b9e answered

I cloned my skill, the lambda is also in eu-west-1.

I added inskill purchasing, then tried to deploy, I get the following:

'Functions from \'eu-west-1\' are not reachable in this region (\'us-east-1\')'

10 |5000

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

newuser-1ea03918-17da-427b-a1d6-2e8f2bbda263 avatar image
newuser-1ea03918-17da-427b-a1d6-2e8f2bbda263 answered

Hi,

I still have issue to create a Skill and Lambda function in eu-west-1 region using ASK Cli.

I found nothing no the internet that would work to fix this problem.

Do we have news about this ?

Thanks,

Regards,

Harold

3 comments
10 |5000

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

Jamie Grossman avatar image Jamie Grossman ♦♦ commented ·

Team are investigating

0 Likes 0 ·
newuser-3f365923-0839-4886-8a2f-73b79f993bf7 avatar image newuser-3f365923-0839-4886-8a2f-73b79f993bf7 Jamie Grossman ♦♦ commented ·

Are there already some news?

0 Likes 0 ·
Ron Wang avatar image Ron Wang commented ·

Hi, what is your issue?

0 Likes 0 ·
Jamie Grossman avatar image
Jamie Grossman answered

Thanks for all the patience.

We have updated our documentation regarding the matter over here.

Thanks,

Jamie

3 comments
10 |5000

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

David Curley avatar image David Curley commented ·

@Jamie, this still doesn't seem to work, and the documentation you refer to is extremely vague about this. For example,

"In order to take advantage of how ASK CLI can create lambda functions for different regions, you must specify the target region or regions in the skill.json file, and use the ARN created for that region."

What does that even mean? For a new skill there's no ARN for the Lambda until it's deployed, and if the ask-cli can't deploy it (this issue!) how would you ever get the ARN? But even if you could do it by hand and get the ARN, how specifically should you "use" it ?

What would help - both here and in the docs - is an actual complete example of a skill.json file that deploys the lambda function to the eu-west-1 region. Or at least the full 'apis' object. Ideally a second example as well, showing how to deploy simultaneously to both us-east-1 AND eu-west-1.

Would that be possible? I'm sure it would help a lot of people here. As it is, 'ask deploy' just isn't usable at all for developers outside the default region, and that's a critical piece of the ask-cli.

0 Likes 0 ·
Jamie Grossman avatar image Jamie Grossman ♦♦ David Curley commented ·

I've passed this feedback on to the team; will get back to you as soon as I have more.

Thanks,

Jamie

0 Likes 0 ·
Ron Wang avatar image Ron Wang David Curley commented ·

Hey Laldy,

ask-cli is good for Lambda deployment for all the regions now.

So the region mapping logic is right now a fixed logic in CLI based on the region mapping rule in the doc. That means CLI will create/retrieve Lambda function only in its related region. (For example default/NA <-> us-east-1). The bug "Functions from \'eu-west-1\' are not reachable in this region (\'us-east-1\')" has been fixed in the launch of v1.5.

In terms of the create-deploy, CLI will create the skill and Lambda in the correct order, and right now if you want to create a eu-west-1 Lambda using CLI, you have to provide the EU region ("sourceDir" and "uri". uri here is the Lambda name you want to use to create).

We highly suggest your using the latest version of CLI (which is later than v1.5), because we move the "uri" field from the hidden project config to skill.json, and keep "merge" field still there for cusomization. By using the latest version, you will want to specify the "api" object to be:

"apis": {
  "custom": {
    "endpoint": {
      "sourceDir": "YOUR_LAMBDA_PATH",
      "uri": "YOUR_LAMBDA_FUNC_NAME_IN_THE_MAPPED_REGION(or true ARN)"
    },
    "regions": {
      "EU": {
        "endpoint": {
          "sourceDir": "",
          "uri": ""
        }
      }
    }
  }
}

(If you use the earlier version, you have to modify the "uri" in "merge" field.)

Thanks,

Ron

0 Likes 0 ·
Dazza65x avatar image
Dazza65x answered

The command still doesn't allow deployment to 2 different regions e.g. us-east-1 and ap-northeast-1. I've resorted to using the aws cli to upload the function code.

2 comments
10 |5000

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

Ron Wang avatar image Ron Wang commented ·

Hi @Dazza65x this issue has been fixed in a version later then CLI@1.5. Please check it out! We also support hook logic like "pre-deploy" hook which might be a good place for applying your aws-cli commands for your customized logics!

0 Likes 0 ·
Bob Denny avatar image Bob Denny Ron Wang commented ·

I want it all to be in us-west-2 because I am in Arizona.

0 Likes 0 ·
newuser-fd1fcd19-5865-4bf2-a186-0ec9e517aaa7 avatar image
newuser-fd1fcd19-5865-4bf2-a186-0ec9e517aaa7 answered

Is there any movement on this?

I've been trying to deploy to an additional region, EU, and it works fine on the first deploy, but then the second deploy just give me:

'Functions from \'eu-west-1\' are not reachable in this region (\'us-east-1\')'

The only workaround I found is to manually delete the localised Lambda (in my case eu-west-1) and then deploying works again.

1 comment
10 |5000

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

Ron Wang avatar image Ron Wang commented ·

Hey which version of the CLI are you using? The issue of 'Functions from \'eu-west-1\' are not reachable in this region (\'us-east-1\')' is now fixed in the latest ask-cli@1.5.1, if you check that out, I believe that will help you!

0 Likes 0 ·
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
10 |5000

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