Monday, May 18, 2020

Google cloud platform

How to transfer Google Cloud project ownership?(tested with my google account)
  • Add members as an Owner with a project.
    • Add -> select member -> select role as owner
  • Accept invitation from destination account.
  • Remove source account from this project.
Moving GCP Projects Between IAM Organizations: (for project transfer)
  • Move the projects out of any folders in the current organization and into the top level (with no organization)
  • Contact Support with the projects that you’d like to move from the current organization to another organization.
  • Support will move the projects out of the current organization so they have no parent (no organization).
  • Move all the projects into the new organization.
Managing organizations:
An organization lets you manage your company’s profile in Google My Business.
Each company is allowed to have only one organization in Google My Business.
Create an organization  steps:
  • Enter your agency’s website address.
  • Sign in with an email address on your agency's domain. 
  • Confirm that this is your agency's primary Google My Business account.
  • Enter more information about your agency and additional owners.
  • Follow the prompts to create your organization.
GOOGLE ACCOUNT: Mainly three types
  • Single account
  • Service account (business account)
  • Group account
Three type of role
Primitive role
  • Owner (project owner role for Jussi)
  • Editor
  • Viewer  (project viewer role for Tushar  for a specific project )
Predefined role (Cloud Storage)
  • CloudStorageAdmin
  • CloudStorageObjectViewer
  • CloudStorageObjectAdmin
  • CloudStorageObjectEditor
Custom role:
  

The Organization resource

Google Cloud users are not required to have an Organization resource, but some features of
Resource Manager will not be usable without one. The Organization resource is closely
associated with a G Suite or Cloud Identity account. When a user with a G Suite or Cloud
Identity account creates a Google Cloud Project, an Organization resource is automatically
provisioned for them.
A G Suite or Cloud Identity account may have exactly one Organization provisioned with it.
Once an Organization resource is created for a domain, all Google Cloud projects created by
members of the account domain will by default belong to the Organization resource.
Ref: 

Folder/Project  Manage:

  1. To manage/create folder you must have folder creator or folder admin role
  2. To create a project you need project creator role
  3. To view the bugs/workflow , you need to set logging permission like log viewer, logging admin
Ref:
References:
  1. https://www.youtube.com/watch?v=st0KLLAhLGk (create group and give group access- teacher ,students)
.

Thursday, May 7, 2020

serverless api authentication






https://github.com/Dropsource/serverless-todo-api-example-complete/blob/master/serverless.yml



0
As @djheru said, Async/Await only works with functions that return promises. I would recommend creating a simple wrapper function to assist with this problem.
const putObjectWrapper = (params) => {
  return new Promise((resolve, reject) => {
    s3.putObject(params, function (err, result) {
      if(err) resolve(err);
      if(result) resolve(result);
    });
  })
}
Then you could use it like this:
const result = await putObjectWrapper(params);
Here is a really great resource on Promises and Async/Await:

Tuesday, May 5, 2020

angular reactive form

https://medium.com/better-programming/how-to-handle-errors-of-angular-reactive-forms-with-three-lines-of-code-3caaa1eb8324 

Saturday, May 2, 2020

DynamoDB Details




  • Amazon DynamoDB has a default limit of 20 global secondary indexes per table, in practice, you can index across far more than 20 data fields




Basic of Dynamodb:

  1. https://medium.com/tensult/core-concepts-of-amazon-dynamodb-a265a3fc70a (Basic ***)

Local Secondary Index vs Global Secondary Index
  1. https://stackoverflow.com/questions/56265577/dynamodb-local-secondary-index-vs-global-secondary-index
  2. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SecondaryIndexes.html ( Dynamodb official difference)
  3. https://stackoverflow.com/questions/55484683/dynamodb-table-index-design-gloabl-index-or-local/55485322#5548532 (***)
Differences:
  • LSIs cannot be modified or deleted without deleting and recreating the whole table. GSIs can be created/removed at any time with no impact to the main table.
  • LSIs cause you to have a limit of 10 GB of data per partition key. Without a LSI, there is a limit of 10 GB per partition, but you won’t notice that because DynamoDB can split your data for a single partition key across multiple partitions if necessary.
  • When using a LSI, the 400kb item size limit applies to the item plus all of its LSI projections. An item in a GSI is counted separately from the item in the main table.
  • Provisioned capacity of GSIs can be scaled independently of the main table, whereas LSIs share the same capacity as the base table.



  • Fast retrieval
  • Auto scaling to control costs
  • Query and scanning allow for different use cases
  • Can get very expensive very fast
  • Sharding and hot spotting are hidden problems that can cause ALOT of head ache
  • Not relational or transactional at all

Single-Table Design for a application:




calculate RCU and WCU with the data
https://stackoverflow.com/questions/42494900/how-to-calculate-read-capacity-unit-and-write-capacity-unit-for-dynamodb/42520860 (***********)



What is throttling(Rejected) in DynamoDB?
AWS DynamoDB Throttling. In a DynamoDB table, items are stored across many partitions according to each item's partition key. ... When a request is made, it is routed to the correct partition for its data, and that partition's capacity is used to determine if the request is allowed, or will be throttled(Rejected)


Getting Started with Amazon Web Services | A Complete Beginner Roadmap



Friday, May 1, 2020

ExpressionChangedAfterItHasBeenCheckedError



Relevant change detection operations steps
A running Angular application is a tree of components. During change detection Angular performs checks for each component which consists of the following operations performed in the specified order:
fddf

Possible fixes of ExpressionChangedAfterItHasBeenCheckedError:
Asynchronous update: use setTimeout
 setTimeout(() => {
            this.parent.name = 'updated name';
        });
Forcing change detection: use the changeDetection
constructor(private cd: ChangeDetectorRef) {
    }

    ngAfterViewInit() {
        this.cd.detectChanges();
    }



Autoboxing and Unboxing

  Autoboxing  is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper cl...