This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -k -X POST "https://<URL>/<index>/_delete_by_query?pretty" -H 'Content-Type: application/json' -d' | |
{ | |
"query": { | |
"bool": { | |
"filter": [ | |
{ | |
"range": { | |
"@timestamp": { | |
"lt": "now-180d" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const doSomething = () => { | |
console.log('Do Something Executed'); | |
} | |
// no callback invoked | |
module.exports.handler = function () { | |
// Lambda finishes AFTER `doSomething()` is invoked | |
setTimeout(() => doSomething(), 1000); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
const s3 = new AWS.S3(); | |
let totalObjects = 0; | |
let dataMap = {}; | |
const formatBytes = (bytes) => { | |
const marker = 1024; | |
const gigaBytes = marker * marker * marker; | |
const decimal = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ethers = require('ethers'); | |
const ECO = require('../contracts/ECOContract.json'); | |
const { CONTRACT_ADDRESS, DEPLOYER_KEY, NETWORK_URL } = process.env; | |
const provider = new ethers.providers.JsonRpcProvider(NETWORK_URL); | |
const deployerWallet = new ethers.Wallet(DEPLOYER_KEY); | |
// This block will come from DynamoDB last checkpoint block | |
const originBlock = 10730324; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk') | |
const STS = new AWS.STS(); | |
const bucketName = 'appgambittest' //bucket where the data files are stored | |
const userId = 'user123' //userId who is requesting temporary access | |
const appId = 'userdir-user123' //directory name where the user data is available on s3 | |
const roleArn = 'arn:aws:iam::XXXXXXXXXX:role/CustomS3AccessRole' //role with trust relationship and full bucket access | |
//generate inline session policy, with restricted access to the specific directory only | |
const generateInlinePolicy = (bucketName, folderName) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MONGO_URL=mongodb+srv://<USER>:<PASSWORD>@<LB>.mongodb.net/?retryWrites=true&w=majority | |
DB= | |
COLLECTION= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Type: AWS::Cognito::UserPoolClient | |
Properties: | |
UserPoolId: !Ref cognitoUserPool | |
AllowedOAuthFlows: | |
- 'implicit' | |
AllowedOAuthFlowsUserPoolClient: true | |
AllowedOAuthScopes: | |
- 'openid' | |
- 'aws.cognito.signin.user.admin' | |
CallbackURLs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this file is in git ignore | |
//you need to create app-config.js, exact similar to this sample file, you can go to cloudformation stack output section to get all values | |
const userPoolId = ''; | |
const normalClientId = ''; | |
const region = 'us-west-2'; | |
const identityPoolId = ''; | |
const S3FilesBucket = ''; | |
//=============== Cognito Group Name =================== | |
const adminGroupName = 'Admin' | |
//===============AWS Cognito Hosted Ui References================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Type: AWS::Cognito::UserPoolClient | |
Properties: | |
UserPoolId: !Ref cognitoUserPool | |
AllowedOAuthFlows: | |
- 'implicit' | |
AllowedOAuthFlowsUserPoolClient: true | |
AllowedOAuthScopes: | |
- 'openid' | |
- 'aws.cognito.signin.user.admin' | |
CallbackURLs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Type: AWS::Cognito::UserPool | |
Properties: | |
AccountRecoverySetting: | |
RecoveryMechanisms: | |
- Name: 'verified_email' | |
Priority: 2 | |
AutoVerifiedAttributes: | |
Policies: | |
PasswordPolicy: |