You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/[platform]/build-a-backend/add-aws-services/analytics/existing-resources/index.mdx
+19-88Lines changed: 19 additions & 88 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,13 +29,29 @@ export function getStaticProps(context) {
29
29
};
30
30
}
31
31
32
+
To use existing Amazon Pinpoint resources with your Amplify backend or frontend application, use the `addOutput` method to surface backend resource outputs to the `amplify_outputs.json` file:
This manual setup enables you to use your existing Amazon Pinpoint resource in your app.
52
+
Alternatively, you can configure the client library directly using `Amplify.configure()`. This manual setup enables you to use your existing Amazon Pinpoint resource in your app.
37
53
38
-
```javascript title="src/index.js"
54
+
```ts title="src/main.ts"
39
55
import { Amplify } from'aws-amplify';
40
56
41
57
Amplify.configure({
@@ -82,88 +98,3 @@ Amazon Pinpoint requires an AWS Identity and Access Management (IAM) policy in o
82
98
```
83
99
84
100
</InlineFilter>
85
-
86
-
<InlineFilterfilters={['flutter']}>
87
-
Existing Amazon Pinpoint resources can be used with the Amplify Libraries by referencing your **Application ID** and **Region** in your `amplifyconfiguration.dart` file.
88
-
89
-
```dart
90
-
{
91
-
"analytics": {
92
-
"plugins": {
93
-
"awsPinpointAnalyticsPlugin": {
94
-
"pinpointAnalytics": {
95
-
"appId": "<your-pinpoint-app-id>",
96
-
"region": "<your-aws-region>"
97
-
},
98
-
"pinpointTargeting": {
99
-
"region": "<your-aws-region>"
100
-
}
101
-
}
102
-
}
103
-
}
104
-
}
105
-
```
106
-
107
-
-**pinpointAnalytics**
108
-
-**appId**: Amazon Pinpoint application ID
109
-
-**region**: AWS Region where the resources are provisioned (e.g. `us-east-1`)
110
-
-**pinpointTargeting**
111
-
-**region**: AWS Region where the resources are provisioned (e.g. `us-east-1`)
112
-
113
-
Note that before you can add an AWS resource to your application, the application must have the Amplify libraries installed. If you need to perform this step, see [Install Amplify Libraries](/[platform]/build-a-backend/add-aws-services/analytics/set-up-analytics/#install-amplify-libraries).
114
-
</InlineFilter>
115
-
116
-
<InlineFilterfilters={['swift']}>
117
-
Existing Amazon Pinpoint resources can be used with the Amplify Libraries by referencing your **Application ID** and **Region** in your `amplify_outputs.json` file.
118
-
119
-
```json
120
-
{
121
-
"analytics": {
122
-
"plugins": {
123
-
"awsPinpointAnalyticsPlugin": {
124
-
"pinpointAnalytics": {
125
-
"appId": "<your-pinpoint-app-id>",
126
-
"region": "<your-aws-region>"
127
-
}
128
-
}
129
-
}
130
-
}
131
-
}
132
-
```
133
-
134
-
-**pinpointAnalytics**
135
-
-**appId**: Amazon Pinpoint application ID
136
-
-**region**: AWS Region where the resources are provisioned (e.g. `us-east-1`)
137
-
138
-
Note that before you can add an AWS resource to your application, the application must have the Amplify libraries installed. If you need to perform this step, see [Install Amplify Libraries](/[platform]/build-a-backend/add-aws-services/analytics/set-up-analytics/#install-amplify-libraries).
139
-
</InlineFilter>
140
-
141
-
<InlineFilterfilters={['android']}>
142
-
Existing Amazon Pinpoint resources can be used with the Amplify Libraries by referencing your **Application ID** and **Region** in your `amplify_outputs.json` file.
143
-
144
-
```json
145
-
{
146
-
"analytics": {
147
-
"plugins": {
148
-
"awsPinpointAnalyticsPlugin": {
149
-
"pinpointAnalytics": {
150
-
"appId": "<your-pinpoint-app-id>",
151
-
"region": "<your-aws-region>"
152
-
},
153
-
"pinpointTargeting": {
154
-
"region": "<your-aws-region>"
155
-
}
156
-
}
157
-
}
158
-
}
159
-
}
160
-
```
161
-
162
-
-**pinpointAnalytics**
163
-
-**appId**: Amazon Pinpoint application ID
164
-
-**region**: AWS Region where the resources are provisioned (e.g. `us-east-1`)
165
-
-**pinpointTargeting**
166
-
-**region**: AWS Region where the resources are provisioned (e.g. `us-east-1`)
167
-
168
-
Note that before you can add an AWS resource to your application, the application must have the Amplify libraries installed. If you need to perform this step, see [Install Amplify Libraries](/[platform]/build-a-backend/add-aws-services/analytics/set-up-analytics/#install-amplify-libraries).
Copy file name to clipboardExpand all lines: src/pages/[platform]/build-a-backend/add-aws-services/geo/existing-resources/index.mdx
+25-93Lines changed: 25 additions & 93 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,15 +27,36 @@ export function getStaticProps(context) {
27
27
};
28
28
}
29
29
30
-
You can also use Amplify Geo with your existing Amazon Location Service resources if you'd like, there are some manual setup that you need to do.
30
+
To use existing Amazon Location Services resources with your Amplify backend or frontend application, use the `addOutput` method to surface backend resource outputs to the `amplify_outputs.json` file:
To use your existing Amazon Location Service resources, i.e. maps and place indices, with Amplify Geo, you need to ensure your role has the right authorization permissions through Cognito.
55
+
To use your existing Amazon Location Service resources (i.e. maps and place indices) with Amplify Geo, you need to ensure your role has the right authorization permissions through Cognito.
35
56
36
57
**Note:** Here is a guide on [Creating an Amazon Cognito identity pool for use with Amazon Location Service](https://docs.aws.amazon.com/location/latest/developerguide/authenticating-using-cognito.html)
37
58
38
-
There are two roles created by Cognito: an `Auth_Role`that grants signed-in-user-level access and an `Unauth_Role` that allows unauthenticated access to resources. Attach the following policies for the appropriate resources and roles (Auth and/or Unauth). Replace `{region}`, `{account-id}`, and `{enter Map/PlaceIndex name}` with the correct items. Note that certain actions cannot be performed with unauthenticated access. The list of actions allowed for the Unauth role is in the [Granting access to Amazon Location Service guide](https://docs.aws.amazon.com/location/latest/developerguide/how-to-access.html).
59
+
There are two roles created by Cognito: an "authenticated role" that grants signed-in-user-level access and an "unauthenticated role" that allows unauthenticated access to resources. Attach the following policies for the appropriate resources and roles (Auth and/or Unauth). Replace `{region}`, `{account-id}`, and `{enter Map/PlaceIndex name}` with the correct items. Note that certain actions cannot be performed with unauthenticated access. The list of actions allowed for the Unauth role is in the [Granting access to Amazon Location Service guide](https://docs.aws.amazon.com/location/latest/developerguide/how-to-access.html).
39
60
40
61
```json
41
62
{
@@ -78,7 +99,7 @@ There are two roles created by Cognito: an `Auth_Role` that grants signed-in-use
You can first import and configure the generated `amplify_outputs.json`. You can then manually configure Amplify Geo like this:
84
105
@@ -116,92 +137,3 @@ Amplify.configure({
116
137
117
138
Now you can proceed to [displaying a map](/[platform]/build-a-backend/add-aws-services/geo/maps/) or [adding location search](/[platform]/build-a-backend/add-aws-services/geo/location-search/) to your app.
118
139
</InlineFilter>
119
-
120
-
121
-
<InlineFilterfilters={['android']}>
122
-
## In your app configuration
123
-
124
-
Amplify Geo is dependent on your Amplify Auth category. If it is not already configured, then you will have to manually configure it as well. In order to manually configure Amplify Geo category, you must edit `amplify_outputs.json` in your project's `src/main/res/raw` directory with your information from existing Amazon Cognito and Amazon Location Service resources.
125
-
126
-
```json
127
-
{
128
-
"Version": "1.0",
129
-
"geo": {
130
-
"plugins": {
131
-
"awsLocationGeoPlugin": {
132
-
"region": <your-geo-region>,
133
-
"maps": {
134
-
"items": {
135
-
<your-map-name>: {
136
-
"style": <your-map-style>
137
-
}
138
-
},
139
-
"default":<your-preferred-default-map>
140
-
},
141
-
"searchIndices": {
142
-
"items": [
143
-
<your-geo-index>
144
-
],
145
-
"default": <your-default-index>
146
-
}
147
-
}
148
-
}
149
-
},
150
-
"auth": {
151
-
"plugins": {
152
-
"awsCognitoAuthPlugin": {
153
-
"Version": "0.1.0",
154
-
"IdentityManager": {
155
-
"Default": {}
156
-
},
157
-
"CredentialsProvider": {
158
-
"CognitoIdentity": {
159
-
"Default": {
160
-
"PoolId": <your-identity-pool-id>,
161
-
"Region": <your-identity-pool-region>
162
-
}
163
-
}
164
-
}
165
-
}
166
-
}
167
-
}
168
-
}
169
-
```
170
-
171
-
Now you can proceed to [displaying a map](/[platform]/build-a-backend/add-aws-services/geo/maps/) or [adding location search](/[platform]/build-a-backend/add-aws-services/geo/location-search/) to your app.
172
-
</InlineFilter>
173
-
174
-
175
-
<InlineFilterfilters={['swift']}>
176
-
## In your app configuration
177
-
178
-
Amplify Geo is dependent on your Amplify Auth category. If it is not already configured, then you will need to [configure it](/[platform]/build-a-backend/auth/set-up-auth/) as well.
179
-
180
-
Existing Amazon Location Service resources can be used with the Amplify Libraries by adding information about the resources to your `amplify_outputs.json` file.
0 commit comments