Skip to content

Commit cf24a06

Browse files
authored
port gen1 changes from aws-amplify#6752 to cli config fragment (aws-amplify#6756)
1 parent 2701167 commit cf24a06

File tree

2 files changed

+84
-19
lines changed

2 files changed

+84
-19
lines changed

src/fragments/cli-config.mdx

Lines changed: 74 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,29 @@
22

33
To set up the Amplify CLI on your local machine, you have to configure it to connect to your AWS account.
44

5-
> If you already have an AWS profile with credentials on your machine, you can skip this step.
5+
<Callout info>
6+
7+
**Note**: If you already have an AWS profile with credentials on your machine, you can skip this step.
8+
9+
</Callout>
610

711
Configure Amplify by running the following command:
812

9-
```bash
13+
```bash title="Terminal"
1014
amplify configure
1115
```
1216

13-
`amplify configure` will ask you to sign into the AWS Console.
17+
<Callout info>
1418

15-
Once you're signed in, Amplify CLI will ask you to create an IAM user.
19+
The `configure` command only supports creating AWS profiles that use permanent credentials. If you are using an IAM role or IAM Identity Center (previously AWS SSO), [learn how to configure Amplify CLI manually](#manually-configure-the-amplify-cli)
20+
21+
</Callout>
22+
23+
`amplify configure` will ask you to sign into the AWS Console.
1624

17-
> Amazon IAM (Identity and Access Management) enables you to manage users and user permissions in AWS. You can learn more about Amazon IAM [here](https://aws.amazon.com/iam/).
25+
Once you're signed in, Amplify CLI will ask you to use the [AWS Identity and Access Management (IAM)](https://aws.amazon.com/iam/) to create an IAM user.
1826

19-
```console
27+
```console title="Terminal"
2028
Specify the AWS Region
2129
? region: # Your preferred region
2230
Follow the instructions at
@@ -52,13 +60,13 @@ On the next page, select **Command Line Interface**, acknowledge the warning, an
5260

5361
![Command Line Interface option selected on the options list.](/images/cli/user-creation/ack-page.png)
5462

55-
On the next page select **Create access key**. Youll then see a page with the access keys for the user. Use the copy icon to copy these values to your clipboard, then return to the Amplify CLI.
63+
On the next page select **Create access key**. You'll then see a page with the access keys for the user. Use the copy icon to copy these values to your clipboard, then return to the Amplify CLI.
5664

5765
![Retrieve access keys page with access key and secret access key copy buttons circled.](/images/cli/user-creation/access-keys-done.png)
5866

5967
Enter the values you just copied into the corresponding CLI prompts.
6068

61-
```console
69+
```console title="Terminal"
6270
Enter the access key of the newly created user:
6371
? accessKeyId: # YOUR_ACCESS_KEY_ID
6472
? secretAccessKey: # YOUR_SECRET_ACCESS_KEY
@@ -67,3 +75,61 @@ This would update/create the AWS Profile in your local machine
6775

6876
Successfully set up the new user.
6977
```
78+
79+
## Manually configure the Amplify CLI
80+
81+
If you are using an IAM role or IAM Identity Center (previously AWS SSO), you can configure your local machine for use with Amplify CLI by creating [AWS profile entries](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-format-profile) manually rather than the `amplify configure` wizard.
82+
83+
To create an AWS profile locally using IAM Identity Center, you can use the AWS CLI wizard, [`aws configure sso`](https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-token.html#sso-configure-profile-token-auto-sso), or write to `~/.aws/config` directly:
84+
85+
<Callout info>
86+
87+
[Learn how to install the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
88+
89+
</Callout>
90+
91+
```toml title="~/.aws/config"
92+
[profile my-sso-profile]
93+
sso_session = my-sso
94+
sso_account_id = 123456789011
95+
sso_role_name = AdministratorAccess-Amplify
96+
region = us-west-2
97+
output = json
98+
99+
[sso-session my-sso]
100+
sso_region = us-east-1
101+
sso_start_url = https://my-sso-portal.awsapps.com/start
102+
sso_registration_scopes = sso:account:access
103+
```
104+
105+
Currently, the Amplify CLI requires a workaround for use with IAM Identity Center due to [an issue in how it resolves credentials](https://github.com/aws-amplify/amplify-cli/issues/4488).
106+
107+
```diff title="~/.aws/config"
108+
[profile my-sso-profile]
109+
sso_session = my-sso
110+
sso_account_id = 123456789011
111+
sso_role_name = AdministratorAccess-Amplify
112+
region = us-west-2
113+
output = json
114+
+ credential_process = aws configure export-credentials --profile my-sso-profile
115+
116+
[sso-session my-sso]
117+
sso_region = us-east-1
118+
sso_start_url = https://my-sso-portal.awsapps.com/start
119+
sso_registration_scopes = sso:account:access
120+
```
121+
122+
Using the example above, when creating a new app or pulling an existing app, specify `my-sso-profile` as the AWS profile you'd like to use with the Amplify app.
123+
124+
To create [an AWS profile locally using an IAM role](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html), assign the `AdministratorAccess-Amplify` permissions set to the role and set the role in your `~/.aws/config` file:
125+
126+
```toml title="~/.aws/config"
127+
[profile amplify-admin]
128+
role_arn = arn:aws:iam::123456789012:role/amplify-admin
129+
source_profile = amplify-user
130+
131+
[profile amplify-user]
132+
region=us-east-1
133+
```
134+
135+
Using the example above, when creating a new app or pulling an existing app, specify `amplify-admin` as the AWS profile you'd like to use with the Amplify app

src/pages/[platform]/tools/cli/start/set-up-cli/index.mdx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ export const meta = {
44
title: 'Set up Amplify CLI',
55
description: 'How to install and configure Amplify CLI',
66
platforms: [
7-
'android',
8-
'angular',
9-
'flutter',
10-
'javascript',
11-
'nextjs',
12-
'react',
13-
'react-native',
14-
'swift',
15-
'vue'
16-
]
7+
'android',
8+
'angular',
9+
'flutter',
10+
'javascript',
11+
'nextjs',
12+
'react',
13+
'react-native',
14+
'swift',
15+
'vue'
16+
]
1717
};
1818

1919
export const getStaticPaths = async () => {
@@ -28,7 +28,6 @@ export function getStaticProps(context) {
2828
}
2929
};
3030
}
31-
3231

3332
## Install the Amplify CLI
3433

0 commit comments

Comments
 (0)