After playing around with the nice browser GUIs of developer.amazon.com and aws.amazon.com things getting serious and now I want to use ask-cli to initialize Alexa skills and their lambda functions.
When I want to ask init
, it tells me, I should select a profile or create a new one. Both jump to the browser and use OAuth to authenticate my ask installation.
~ ask init
? Please create a new profile or overwrite the existing profile.
(Use arrow keys)
──────────────
❯ Create new profile
──────────────
Profile Associated AWS Profile
[default] ** NULL **
[aws_profile] ** NULL **
But the AWS Profile will not associate my AWS Profile.
My LamdaFunction will not load/deploy, if I don't connect the profile with AWS.
No AWS credential setup for profile: [default].
Lambda clone skipped. CLI lambda functionalities can be enabled
by running `ask init` again to add 'aws_profile' to ASK cli_config
How could I connect my ask-cli correctly?
You need to first download and install aws CLI on your local machine. You can download aws CLI from below link.
http://docs.aws.amazon.com/cli/latest/userguide/installing.html
If you are working with your root account user then you have to generate your access ID and secret key else you have to create new IAM user with lambda execute permission.
You can generate root user access ID and secret key from below link. https://console.aws.amazon.com/iam/home
Then click on Manage Security credential as shown in below image and after ignoring the warnings you can process and click Access Key ID and secret key link and generate new one and copy them.
Run aws configure command to configure your aws account and it will ask for Access ID and secret key that you generated and will setup your aws account.
aws configure
After aws configure, you can run again ask init command again to configure account.
ask init
Well, you don't need to setup an aws-cli when you already have an ask-cli installed.
Instead you can run below command to setup AWS credentials and link to an ASK profile, if somehow aws credentials are not setup.
ask init --aws-setup
Then, you will be prompted to enter your profile name, your access key, and your secret access key. You can use profile name as default if you have not created multiple ASK profiles. This will automatically create an aws credentials file at %USERPROFILE%.aws\credentials location. Now every time you try to deploy/access lambda code through ask-cli, it will access the credentials from this file.
来源:https://stackoverflow.com/questions/46811054/how-to-configure-alexa-ask-cli-with-a-valid-aws-profile