Wednesday, November 29, 2023

NAT Gateway

 

Azure provides customers with the resources to establish public and private plane network connectivity. By placing resources in a virtual network with subnets each for different address ranges, an organization can secure inbound and outbound access to those resources. As resources are assigned to subnets, traffic can be contained within the virtual network. By providing inbound and outbound access only to the virtual network, resources eliminate their accessibility from the internet. This improves security but sometimes there is a need for resources to access targets on the internet. One way to provide internet access is with the use of a NAT Gateway.

Azure Network Address Translation (NAT) Gateway is a fully managed and highly resilient NAT service that provides outbound connectivity to the internet through the deployment of a NAT gateway resource. A NAT gateway can be used so that instances in a private subnet can connect to services outside the VPC, but external services cannot initiate a connection with those instances. A NAT gateway can be attached to multiple subnets within a virtual network to provide outbound connectivity to the internet.  Some benefits of NAT include the reuse of private IP addresses, enhancing of security for private networks by keeping internal addressing private from the external network, and connecting many hosts to the global Internet using a smaller number of public (external) IP address, thereby conserving IP address space.

If the virtual network address space has multiple address ranges defined, Azure creates an individual route for each address range. Azure automatically routes traffic between subnets using the routes created for each address range. Gateways don’t need to be defined for Azure to route traffic between subnets.

The system default route specifies the 0.0.0.0/0 address prefix. If Azure’s default routes are not overridden, Azure routes traffic for any address not specified by an address range within a virtual network to the Internet. There's one exception to this routing. If the destination address is for one of Azure's services, Azure routes the traffic directly to the service over Azure's backbone network, rather than routing the traffic to the Internet. Traffic between Azure services doesn't traverse the Internet, regardless of which Azure region the virtual network exists in, or which Azure region an instance of the Azure service is deployed in. Azure's default system route for the 0.0.0.0/0 address prefix can be overridden with a custom route.

An Azure NAT Gateway in a subnet can provide outbound connectivity for all private resources in that subnet. This includes traffic from other subnets within the same virtual network but they must be associated. A NAT gateway can be attached to multiple subnets for outbound connectivity. It can be assigned up to 16 public IP addresses or a /28 size public IP prefix. It takes precedence over a load balancer with or without outbound rules. It becomes the next hop type for all internet destined traffic. A NAT gateway can't span beyond a single virtual network. It provides source network address translation (SNAT) for private instances within subnets of an Azure virtual network.

Tuesday, November 28, 2023

ADF Programmability

Sample invocations with responses:

PUT https://management.azure.com/subscriptions/656e67c6-f810-4ea6-8b89-636dd0b6774c/resourceGroups/rg-temp/providers/Microsoft.DataFactory/factories/rajamadf1/linkedservices/AmazonS3LinkedService?api-version=2018-06-01?factoryName=rajamadf1&linkedServiceName=AmazonS3LinkedService&resourceGroupName=rg-temp&subscriptionId=656e67c6-f810-4ea6-8b89-636dd0b6774c&api-version=2018-06-01

Headers:

Content-Type: application/json

Authorization: Bearer

RequestBody:

{

              properties: {

          "type": "AmazonS3",

          "typeProperties": {

             "connectionString": {

                 "type": "SecureString",

                 "value": "https://b67.s3.us-east-1.amazonaws.com/20231114_183657.jpg?response-content-disposition=inline&X-Amz-Security-Token=Token1&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20231127T011622Z&X-Amz-SignedHeaders=host&X-Amz-Expires=43200&X-Amz-Credential=ASIAWBUSJVLECCOOMERM%2F20231127%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=29874c234eab5d9416e1158d3e5ba8513f163227b538258a295f78a35bcae1ee"

             }

          }

        }

}

 

Response:

Code: 200

Headers:

cache-control: no-cache

content-type: application/json; charset=utf-8

date: Mon, 27 Nov 2023 01:17:16 GMT

expires: -1

pragma: no-cache

server: Kestrel

x-ms-correlation-request-id: 235732c1-d0b1-402a-a3ee-d64366b8207d

x-ms-ratelimit-remaining-subscription-writes: 1199

x-ms-request-id: 235732c1-d0b1-402a-a3ee-d64366b8207d

x-ms-routing-request-id: WESTUS2:20231127T011716Z:235732c1-d0b1-402a-a3ee-d64366b8207d

 

Body:

{

  "id": "/subscriptions/656e67c6-f810-4ea6-8b89-636dd0b6774c/resourceGroups/rg-temp/providers/Microsoft.DataFactory/factories/rajamadf1/linkedservices/AmazonS3LinkedService",

  "name": "AmazonS3LinkedService",

  "type": "Microsoft.DataFactory/factories/linkedservices",

  "properties": {

    "type": "AmazonS3",

    "typeProperties": {

      "connectionString": {

        "type": "SecureString",

        "value": "**********"

      }

    }

  },

  "etag": "9e06116d-0000-0100-0000-6563ee1c0000"

}

 

Sample REST call to trigger a run:

POST https://management.azure.com/subscriptions/656e67c6-f810-4ea6-8b89-636dd0b6774c/resourceGroups/rg-temp/providers/Microsoft.DataFactory/factories/rajamadf1/pipelines/pipeline1/createRun?api-version=2018-06-01

Authorization: Bearer <token>

Content-type: application/json

 

Response:

Code: 200

Headers

cache-control: no-cache

content-type: application/json; charset=utf-8

date: Mon, 27 Nov 2023 01:56:03 GMT

expires: -1

pragma: no-cache

server: Kestrel

x-ms-correlation-request-id: cd5087fd-a9e9-4997-8ccc-d896788dc19f

x-ms-ratelimit-remaining-subscription-writes: 1199

x-ms-request-id: cd5087fd-a9e9-4997-8ccc-d896788dc19f

x-ms-routing-request-id: WESTUS2:20231127T015604Z:cd5087fd-a9e9-4997-8ccc-d896788dc19f

 

Body:

{

  "runId": "e62d495e-cadb-4294-b466-619ec7e5961f"

}

 

 

These sample REST calls are also available via CLI command usages when viewed with the –debug and –verbose option.

For example,

az datafactory dataset create --factory-name rajamadf1 --name AmazonS3SourceDataset1 --linked-service-name AmazonS3LinkedService1 --type AmazonS3Object --schema "{ \"type\": \"object\", \"properties\": { \"fileName\": { \"type\": \"string\" } } }" --structure "{ \"type\": \"object\", \"properties\": { \"fileName\": { \"type\": \"string\" } } }" --debug --verbose

 

Monday, November 27, 2023

 

This is a summary of the book titled “Coachability – the Leadership Superpower” by Kevin Wilde written in 2022. He is an executive leadership fellow at the University of Minnesota and has worked as senior talent development executive at General Mills and General Electric for seventeen years each.

In this book, Kevin convinces us that accepting feedback as a leader is far more valuable than learning how to deliver it and he calls this trait “coachability”. No matter the background, age, sex or any other forms of discrimination, it applies across the board, and anyone can do it.

Age, however, can be called out as one of the leading contributors to the decline of receptivity to coaching. Firms want leaders to coach so they promote coaching skills, but they overlook the importance of coachability. This causes leaders to lose their effectiveness and their ability to continually develop, which is critical.

Instead of indirect skills, coachability is a direct skill because clear feedback can accelerate us in the right direction. Even keeping a coachability notebook and starting to record can be a helpful practice

Some resistance to coachability is both genuine and natural. When leaders are put through a game to meet with each other and explain their weaknesses, they might resist behaving so vulnerably but they end up participating with gusto. An aversion to vulnerability, desire to maintain control or fear of the unknown can get in the way. Coachability requires openness and a commitment to learn continuously.

Other factors that hinder coachability include arrogance as demonstrated by those who feel they have reached the finish line, façade of strength which appears to hide ignorance or fear, susceptibility to flattery when leaders want yes men, isolation when promoted leaders can find themselves removed from their peer, and deprioritizing feedback because leaders can choose to procrastinate.

Highly coachable leaders, on the other hand, stand apart and people recognize their trait. They inspire higher levels of motivation and engagement and lead to greater productivity, sales, and satisfaction.

Coachability depends on practice and mindset more than innate traits. These leaders don’t just remain open to feedback but they seek it out, and listen carefully. They reflect on what they have heard, assessing its value and relevance to make their own determination about what to embrace or discard.

Seven strategies that can help us to be more coachable include being specific by asking clear questions, asking two questions on what went well and what could be done better, holding after-action reviews on why it happened and how to improve next time, making a plan for our own learning and development, asking a truth-teller, looking for signs that can be direct and indirect and seeking clarification whenever doubtful.

The truth is that our experience of receiving the so-called gift of feedback is not all that pleasant. Like a good actor, rather than get defensive, we can tell ourselves to take a note.

Reference:

Previous Book Summaries: BookSummary20.docx

 

Sunday, November 26, 2023

 

This is a summary of a fun-read-book titled “The Everyday Warrior” - A no hack practical approach to life written by Mike Sarraille in 2022. He talks about life holding valuable lessons as we go along the way to achieving our goals. He even calls out failures to find encouragement not discouragement. Using military terminology, he teaches soft skills such as drive, resilience, and a positive attitude. He says maintaining a balance between physical, mental, and emotional needs is important. Finally, he talks about why shortcuts disappoint and the journey is often its own reward.

The main take-aways are that the “Everyday warrior” uses failure as a teacher and motivator. Mentally fit people treat the brain as a muscle they condition, exercise and rest. Time constraints, fear, doubt and weak initiative prevent people from committing to achieving their goals. Instant gratification must be avoided and instead a step-by-step technique can be adopted to pursue one’s goals. People yearn for connection via a social circle or tribe. Time must be taken to rest and reflect.

Maintaining a balance when striving towards goals is an art and a science. We cannot let anxiety, depression, social isolation, apathy and frustration deter us. The Everyday warrior’s traits are instead resilience, confidence, positive attitude, and a drive to achieve and improve. This mindset makes us accountable, disciplined, pragmatic, vulnerable, humble and capable of honest self-assessment.

Consider that Michael Phelps, the Olympian swimmer won 23 gold medals and constantly sought to achieve success in Olympics at the cost of a balanced boyhood and resulting in subsequent struggles with alcohol and drug abuse. The “whole person concept”, on the other hand, practiced by Army Green Berets and Navy Seal recruiters who excel in volatile, uncertain, complex and ambiguous aka VUCA situations.

An everyday warrior knows when to rest and care for oneself is as important as fighting the battle. Acquiring self-knowledge is challenging because media, school, families, and “external influences” shape what people think they want. Comparing oneself with others or choosing goals based on how others will perceive them is not the right approach. Instead, we must determine our own definition of success. An example of this is that Marine Rob Jones lost both his legs in Afghanistan tour to an IED but when he returned he made it his goal to raise funds for veterans. As part of one of his campaigns, he ran 31 marathons in 31 days. There is even a famous saying attributed to stoic king Marcus Aurelius who said that we cannot control events but we can control our mind. We must shift away from a victim mind-set. People only fail to reach their goal out of doubt, fear, time-constraints, and unwillingness to make the required effort.

The five steps to succeed are 1. To set a smart goal, 2. Develop a plan of sequential tasks aka “small victories”, 3. Taking actions that disrupt the comfort of old habits, 4. Making time for introspection, and 5. And repeating the process until we are “more accomplished and capable.”

We must avoid shortcuts in pursuing our goals. Building resistance to instant gratification by showing gratitude and training oneself to avoid instant rewards will help us in the long run.

Previous book summaries: BookSummary17.docx

Saturday, November 25, 2023

 

This is a summary of a book titled “The Four Factors of Trust” – how organizations can earn lifelong loyalty, written by Ashley Reichheld and Amelia Dunlop. As we get inundated with information from various multimedia sources, it is hard to know who is telling the truth and which sources to believe. Ashley is a principal at Deloitte Digital and Amelia is the Chief Experience Officer. They provide an easy-to-follow blueprint for establishing and maintaining trust.

Trust is essential to relationships, both imposed and sought after. All parties involved must strive to earn trust but some more than others. It is not just a critical component but the foundation. Knowing that an individual or a company will act with integrity and clarity while pursuing its objectives ethically, is both empowering and relieving. Trust enables both to be vulnerable to each other.

Trust does not just determine the current course of action, but it also affects the future. Workers who trust their employers are shown to be more motivated and less likely to look for other jobs. Some relationships are transactional and contractual, but others endure. Even though trust is threatened from many quarters, it must be diligently reinforced, or relationships will fail. People often mistake not listening or neglecting to cause relationships to fail but while they emphasize the means, trust emphasizes the tenet holding the relationship. There are numerous examples of how trust erodes all around us be it personal, social, community or the news.

It consists of four pivotal factors:

Humanity – A sense of shared humanity is significant to any human interaction. It dominates the process of how businesses and relationships are conducted.

Transparency – As companies strive to create an informed, seamless experience for their customers, they improve transparency.

Capability – Expectations can be fulfilled three times more likely when there is caring involved because it makes them competent and capable.

Reliability – Companies can be capable but still undependable. By meeting the expectations consistently, we gain a reputation as reliable that adds to trust. For example, FedEx evokes trust by meeting shipment targets on time.

People want your communications to show you understand them, know their desires and beliefs, and respect them.  Trustworthy organizations invest in humanity, transparency, capability, and reliability.  A respected healthcare corporation earns a strong humanity score by prioritizing patient needs.  A community of senior citizens benefitted from a diabetes treatment center in this case.

Hospitality organizations rank high in all four factors and serve as exemplary case studies. They have shown that it takes strong empathetic leadership to give tough messages in plain language. Marriott CEO Arne Sorenson rode over the pandemic crisis by taking 50% pay cut for entire executive leadership team and making severe staff cuts and explained his message in a heart-felt video stating that everyone must bear the brunt of the pandemic.

Leaders and consumers view organizational trust from different perspectives. They are often at odds with each other. Even when companies work to make it easy to do business with them, they focus on the wrong approaches. The “trust gap” is compensated by a driven approach towards performance in terms of capability and reliability. A consumer might have a three-strikes policy that she can grant to the business if the business tries to resolve it each time. Many financial companies have a high concentration of neutral trust scores. Edward Jones, sought to differentiate from the pack and achieved 30% above the average in perceived capability. The company trains all its advisors who live in the communities where they work to have face-to-face relationships with clients to build trust with them.

Trusting your employees helps them sustain positive relationships with clients. An inspired workforce is twice as likely to deliver improved customer satisfaction than a disengaged workforce. Trust isn’t an entitlement, both people and organizations must earn it.

A breach of trust can be repaired more easily if we have a strategy for making the relationship right again, rather than just randomly experimenting with possible remedies. Determine the objectives of the trust initiative, then assemble data that outlines the current situation and future goals. Anything any employee, customer, or partner says or does could make headlines and erode trust. Some of the quickest wins come from observing the effects of how we communicate with people and what access we are giving them to information. If you are trusted as a brand, you don’t have to use your finite marketing dollars to convince people that your product is high quality and valuable.

Previous book summaries: BookSummary22.docx

 

 

 

Friday, November 24, 2023

 

Decode ways:

A message containing letters from A-Z can be encoded into numbers using the following mapping:

'A' -> "1"

'B' -> "2"

...

'Z' -> "26"

To decode an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For example, "11106" can be mapped into:

  • "AAJF" with the grouping (1 1 10 6)
  • "KJF" with the grouping (11 10 6)

Note that the grouping (1 11 06) is invalid because "06" cannot be mapped into 'F' since "6" is different from "06".

Given a string s containing only digits, return the number of ways to decode it.

The test cases are generated so that the answer fits in a 32-bit integer.

 

Example 1:

Input: s = "12"

Output: 2

Explanation: "12" could be decoded as "AB" (1 2) or "L" (12).

Example 2:

Input: s = "226"

Output: 3

Explanation: "226" could be decoded as "BZ" (2 26), "VF" (22 6), or "BBF" (2 2 6).

Example 3:

Input: s = "06"

Output: 0

Explanation: "06" cannot be mapped to "F" because of the leading zero ("6" is different from "06").

 

Constraints:

  • 1 <= s.length <= 100
  • s contains only digits and may contain leading zero(s).

 

class Solution {

    public int numDecodings(String s) {

        Integer count = 0;

        if (isValid(s.substring(0,1)))

            traverse(s.substring(1), count);

        if (s.length() >= 2 && isValid(s.substring(0,2)))

            traverse(s.substring(2), count);

        return count;

    }

    public boolean traverse(String s, Integer count) {

        if (String.isNullOrWhitespace(s)){

            count += 1;

            return true;

        }

        if (isValid(s.substring(0,1)))

            traverse(s.substring(1), count);

        if (s.length() >= 2 && isValid(s.substring(0,2)))

            traverse(s.substring(2), count);

        return count > 0;

    }

    public boolean isValid(String s) {

        if (s.length() == 1 && s.charAt(0) >= '0' && s.charAt(0) <= '9'){

            return true;

        }

        if (s.length() == 2 &&

           (s.charAt(0) > '0' && s.charAt(0) <= '2') &&

           ((s.charAt(0) == '1' && s.charAt(1) >= '0' && s.chartAt(1) <= '9') ||

            (s.charAt(0) == '2' && s.chartAt(1) >= '0' && s.chartAt(1) <= '6')) {

            return true;

        }

        return false;

    }

}