This file contains hidden or 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
import boto3 | |
import os | |
import datetime | |
""" | |
This portion will obtain the Environment variables from AWS Lambda. | |
""" | |
GROUP_NAME = os.environ['GROUP_NAME'] |
This file contains hidden or 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
import os | |
import time | |
import sys | |
import boto3 | |
REGION = "eu-central-1" | |
S3_CLIENT = boto3.client("s3", REGION) | |
COGNITO_CLIENT = boto3.client("cognito-idp", REGION) | |
USER_POOL_ID = os.environ['USER_POOL_ID'] | |
EXPORTED_RECORDS_COUNT = 0 |
This file contains hidden or 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
cloudshell-user@ip-10-0-93-38 ~]$ aws cognito-idp get-csv-header --user-pool-id "eu-west-1_XXXXXXX" | |
{ | |
"UserPoolId": "eu-west-1_XXXXXXX", | |
"CSVHeader": [ | |
"name", | |
"given_name", | |
"family_name", | |
"middle_name", | |
"nickname", | |
"preferred_username", |
This file contains hidden or 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
name | given_name | family_name | middle_name | nickname | preferred_username | profile | picture | website | email_verified | gender | birthdate | zoneinfo | locale | phone_number | phone_number_verified | address | updated_at | custom:joinedOn | cognito:mfa_enabled | cognito:username | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
probko | [email protected] | TRUE | FALSE | FALSE | probko.testov |
This file contains hidden or 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
import { Construct, Duration, Stack } from '@aws-cdk/core'; | |
import { Bucket, BucketEncryption } from '@aws-cdk/aws-s3'; | |
import { Code, Function, IFunction, Runtime } from '@aws-cdk/aws-lambda'; | |
import * as path from 'path'; | |
import { Effect, PolicyStatement } from '@aws-cdk/aws-iam'; | |
export interface CognitoUserMigrationLambdaProps { | |
readonly userPoolId: string; | |
readonly bucketName: string; |
This file contains hidden or 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 { URL } = require('url'); | |
const synthetics = require('Synthetics'); | |
const log = require('SyntheticsLogger'); | |
const syntheticsConfiguration = synthetics.getConfiguration(); | |
const syntheticsLogHelper = require('SyntheticsLogHelper'); | |
const AWS = require('aws-sdk'); | |
AWS.config.update({ | |
region: 'eu-central-1', | |
}); | |
//Username and password should be passed by using Secrets Manager get secret value api call. |
This file contains hidden or 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 loadBlueprint = async function() { | |
const response = login(USERNAME, PASSWORD); | |
const bearerToken = (await response).AuthenticationResult.IdToken; | |
const urls = ['https://probkotestov.io/api-users/setting']; | |
// Set screenshot option | |
const takeScreenshot = true; | |
/* Disabling default step screen shots taken during Synthetics.executeStep() calls | |
* Step will be used to publish metrics on time taken to load dom content but |
This file contains hidden or 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
async function login(email, password) { | |
try { | |
const cognito = new AWS.CognitoIdentityServiceProvider(); | |
return await cognito.initiateAuth({ | |
AuthFlow: 'USER_PASSWORD_AUTH', | |
ClientId: 'XXXXXXXXXXXXXXXXXXX', | |
AuthParameters: { | |
USERNAME: email, | |
PASSWORD: password, | |
}, |
This file contains hidden or 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 loadUrl = async function(page, url, takeScreenshot) { | |
let stepName = null; | |
let domcontentloaded = false; | |
try { | |
stepName = new URL(url).hostname; | |
} catch (error) { | |
const errorString = `Error parsing url: ${url}. ${error}`; | |
log.error(errorString); | |
/* If we fail to parse the URL, don't emit a metric with a stepName based on it. |
This file contains hidden or 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
// Creation of databrew role used by forecast and databrew | |
const dataBrewRole = new Role(this, 'costAndUsageReportRole', { | |
roleName: 'dataBrewServiceRole', | |
assumedBy: new CompositePrincipal( | |
new ServicePrincipal('databrew.amazonaws.com'), | |
new ServicePrincipal('forecast.amazonaws.com'), | |
), | |
path: '/service-role/', | |
}); |
OlderNewer