Skip to content

Commit decb07e

Browse files
committed
Integrated AWS (account) as cloud provider via AWS Amplify
Signed-off-by: Lars Haferkamp <lars.haferkamp@comsysto.com>
1 parent 667216b commit decb07e

11 files changed

Lines changed: 500 additions & 8 deletions

File tree

examples/demo-app/README.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,58 @@ export MapboxAccessToken=<your_mapbox_token>
2323
```
2424

2525
#### 3. Start the app
26-
2726
```sh
2827
npm start
2928
```
29+
30+
## Cloud Providers
31+
32+
### Connecting your AWS Account
33+
34+
#### 1. Setup AWS Amplify CLI
35+
[Install and configure](https://docs.amplify.aws/cli/start/install) the Amplify CLI:
36+
```sh
37+
npm install -g @aws-amplify/cli
38+
```
39+
```sh
40+
amplify configure
41+
```
42+
43+
#### 2. Setup AWS services needed
44+
45+
Setup AWS [Authentication](https://docs.amplify.aws/cli/auth/overview) and [Storage](https://docs.amplify.aws/lib/storage/getting-started/q/platform/js)
46+
47+
These steps create a new Cloudformation stack, a Cognito user pool and a S3 bucket and connect both via policies.
48+
49+
```sh
50+
amplify add auth
51+
```
52+
```sh
53+
amplify add storage
54+
```
55+
56+
Always finish Amplify changes by:
57+
```sh
58+
amplify push
59+
```
60+
61+
If Amplify services only needs to be updated run
62+
```sh
63+
amplify update auth
64+
```
65+
```sh
66+
amplify update storage
67+
```
68+
69+
#### 3. AWS Amplify configuration for Kepler.gl
70+
71+
Copy the file `aws-exports.js` generated by the previous step into the `demo-app/src` folder (there is already an empty one to avoid startup problems)
72+
73+
Finally, set the AWSAccountName (just for display) in the environment:
74+
```sh
75+
export AWSAccountName=demo-account
76+
```
77+
78+
#### Notes on AWS as cloud provider
79+
- URLs of shared maps expire after one hour.
80+

examples/demo-app/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
"start-local-https": "webpack-dev-server --mode development --https --env.es6 --progress --hot --open"
1010
},
1111
"dependencies": {
12+
"@aws-amplify/storage": "3.2.0",
13+
"@aws-amplify/ui-react": "^0.2.5",
1214
"@carto/toolkit": "0.0.1-rc.18",
15+
"aws-amplify": "3.0.11",
1316
"d3-request": "^1.0.6",
1417
"dropbox": "^4.0.12",
1518
"global": "^4.3.0",
@@ -55,11 +58,12 @@
5558
"babel-loader": "^8.0.0",
5659
"babel-plugin-module-resolver": "^3.0.0",
5760
"babel-plugin-transform-builtin-extend": "^1.1.0",
61+
"json-loader": "^0.5.7",
5862
"webpack": "^4.29.0",
5963
"webpack-cli": "^3.2.1",
6064
"webpack-dev-middleware": "^3.5.1",
6165
"webpack-dev-server": "^3.1.14",
6266
"webpack-hot-middleware": "^2.24.3",
6367
"webpack-stats-plugin": "^0.2.1"
6468
}
65-
}
69+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* eslint-disable */
2+
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (c) 2020 Uber Technologies, Inc.
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in
11+
// all copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
// THE SOFTWARE.
20+
21+
import React, {Component} from 'react';
22+
23+
class AwsIcon extends Component {
24+
render() {
25+
return (
26+
<div className={'data-ex-icons-aws'} style={{padding: '5px 15px'}}>
27+
<img
28+
width={'100%'}
29+
src="https://d1.awsstatic.com/logos/aws-logo-lockups/poweredbyaws/PB_AWS_logo_RGB_stacked.547f032d90171cdea4dd90c258f47373c5573db5.png"
30+
alt="Powered by AWS Cloud Computing"
31+
/>
32+
</div>
33+
);
34+
}
35+
}
36+
37+
export default AwsIcon;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) 2020 Uber Technologies, Inc.
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in
11+
// all copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
// THE SOFTWARE.
20+
21+
import React, {useEffect} from 'react';
22+
import Amplify, {Hub} from 'aws-amplify';
23+
import awsconfig from '../../aws-exports';
24+
import {AmplifyAuthenticator} from '@aws-amplify/ui-react';
25+
26+
Amplify.configure(awsconfig);
27+
export const AWS_LOGIN_URL = 'aws/aws-login';
28+
export const AWS_WEB_CLIENT_ID = awsconfig && awsconfig.aws_cognito_identity_pool_id;
29+
30+
const AwsLogin = () => {
31+
useEffect(() => {
32+
Hub.listen('auth', data => {
33+
const {payload} = data;
34+
if (payload.event === 'signIn') {
35+
window.opener.postMessage({success: true}, location.origin);
36+
}
37+
});
38+
}, []);
39+
40+
return <AmplifyAuthenticator usernameAlias="email" />;
41+
};
42+
43+
export default AwsLogin;

0 commit comments

Comments
 (0)