Skip to content

Instantly share code, notes, and snippets.

Anjan B. annjawn

Block or report user

Report or block annjawn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@annjawn
annjawn / index.js
Last active Dec 8, 2018
React Component to upload file to S3 using AWS Amplify
View index.js
import React, { Component } from "react";
import ReactDOM from "react-dom";
import { configureAmplify, SetS3Config } from "./services";
import Storage from "@aws-amplify/storage";
import "./styles.css";
class App extends Component {
state = {
imageName: "",
imageFile: "",
@annjawn
annjawn / trustrelation.json
Created Dec 6, 2018
Cognito Identity pool Auth role trust relationship with S3
View trustrelation.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "cognito-identity.amazonaws.com"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
@annjawn
annjawn / authpermission.json
Created Dec 6, 2018
Cognito identity pool Auth Role Permission for S3
View authpermission.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"mobileanalytics:PutEvents",
"cognito-sync:*",
"cognito-identity:*"
],
@annjawn
annjawn / services_updated.js
Last active Dec 6, 2018
Modular import Amplify and configure core and Storage
View services_updated.js
import Amplify from '@aws-amplify/core';
import Storage from '@aws-amplify/storage';
export function configureAmplify() {
Amplify.configure(
{
Auth: {
identityPoolId: process.env.REACT_APP_identityPoolId,
region: process.env.REACT_APP_region,
userPoolId: process.env.REACT_APP_userPoolId,
@annjawn
annjawn / services.js
Last active Dec 5, 2018
Modular import of amplify core
View services.js
import Amplify from '@aws-amplify/core';
export function configureAmplify() {
Amplify.configure(
{
Auth: {
identityPoolId: process.env.REACT_APP_identityPoolId,
region: process.env.REACT_APP_region,
userPoolId: process.env.REACT_APP_userPoolId,
userPoolWebClientId: process.env.REACT_APP_userPoolWebClientId,
You can’t perform that action at this time.