Skip to content

Commit bd4dccd

Browse files
josefaidtreesscot
andauthored
fix geo manual author callouts (#7473)
* fix geo manual author callouts * revise geo and pinpoint --------- Co-authored-by: Scott Rees <[email protected]>
1 parent 4d37dca commit bd4dccd

File tree

2 files changed

+44
-181
lines changed
  • src/pages/[platform]/build-a-backend/add-aws-services

2 files changed

+44
-181
lines changed

src/pages/[platform]/build-a-backend/add-aws-services/analytics/existing-resources/index.mdx

Lines changed: 19 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,29 @@ export function getStaticProps(context) {
2929
};
3030
}
3131

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:
33+
34+
```ts title="amplify/backend.ts"
35+
import { defineBackend } from "@aws-amplify/backend"
36+
37+
const backend = defineBackend({})
38+
39+
backend.addOutput({
40+
analytics: {
41+
amazon_pinpoint: {
42+
aws_region: "<your-aws-region>",
43+
app_id: "<your-pinpoint-app-id>",
44+
},
45+
},
46+
})
47+
```
3248

3349
<InlineFilter filters={['javascript', 'react-native', "angular", "nextjs", "react", "vue"]}>
34-
## Set up existing analytics backend
50+
## Configuring client library directly
3551

36-
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.
3753

38-
```javascript title="src/index.js"
54+
```ts title="src/main.ts"
3955
import { Amplify } from 'aws-amplify';
4056

4157
Amplify.configure({
@@ -82,88 +98,3 @@ Amazon Pinpoint requires an AWS Identity and Access Management (IAM) policy in o
8298
```
8399

84100
</InlineFilter>
85-
86-
<InlineFilter filters={['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-
<InlineFilter filters={['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-
<InlineFilter filters={['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).
169-
</InlineFilter>

src/pages/[platform]/build-a-backend/add-aws-services/geo/existing-resources/index.mdx

Lines changed: 25 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,36 @@ export function getStaticProps(context) {
2727
};
2828
}
2929

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:
31+
32+
```ts title="amplify/backend.ts"
33+
import { defineBackend } from "@aws-amplify/backend"
34+
35+
const backend = defineBackend({})
36+
37+
backend.addOutput({
38+
geo: {
39+
aws_region: "<your-aws-region>",
40+
maps: {
41+
items: {
42+
"<your-friendly-map-name>": {
43+
name: "<your-map-name>",
44+
style: "<your-map-style>",
45+
},
46+
},
47+
default: "<your-friendly-map-name>",
48+
},
49+
},
50+
})
51+
```
3152

3253
## Authorization permissions
3354

34-
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.
3556

3657
**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)
3758

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).
3960

4061
```json
4162
{
@@ -78,7 +99,7 @@ There are two roles created by Cognito: an `Auth_Role` that grants signed-in-use
7899
```
79100

80101
<InlineFilter filters={['javascript', 'angular', 'react', 'vue', 'react-native', 'nextjs']}>
81-
## In your application
102+
## Configure client library directly
82103

83104
You can first import and configure the generated `amplify_outputs.json`. You can then manually configure Amplify Geo like this:
84105

@@ -116,92 +137,3 @@ Amplify.configure({
116137

117138
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.
118139
</InlineFilter>
119-
120-
121-
<InlineFilter filters={['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-
<InlineFilter filters={['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.
181-
182-
```json
183-
{
184-
"geo": {
185-
"plugins": {
186-
"awsLocationGeoPlugin": {
187-
"region": <your-geo-region>,
188-
"maps": {
189-
"items": {
190-
<your-map-name>: {
191-
"style": <your-map-style>
192-
}
193-
},
194-
"default": <your-default-style>
195-
},
196-
"searchIndices": {
197-
"items": [
198-
<your-geo-index>
199-
],
200-
"default": <your-default-index>
201-
}
202-
}
203-
}
204-
}
205-
}
206-
```
207-
</InlineFilter>

0 commit comments

Comments
 (0)