<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Harsh Muniwala on Medium]]></title>
        <description><![CDATA[Stories by Harsh Muniwala on Medium]]></description>
        <link>https://medium.com/@harshmuniwala11?source=rss-3996b8ee8f4e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*io13Cz81KCKdFVJny607gw.jpeg</url>
            <title>Stories by Harsh Muniwala on Medium</title>
            <link>https://medium.com/@harshmuniwala11?source=rss-3996b8ee8f4e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 06:21:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@harshmuniwala11/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Amazon web services: Wordpress configuration on ECS using ECR images]]></title>
            <link>https://medium.com/petabytz/amazon-web-services-wordpress-configuration-on-ecs-using-ecr-images-9c1e97d05aaa?source=rss-3996b8ee8f4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c1e97d05aaa</guid>
            <category><![CDATA[aws-ecr]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[elastic-container-service]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Harsh Muniwala]]></dc:creator>
            <pubDate>Wed, 11 Sep 2019 10:23:33 GMT</pubDate>
            <atom:updated>2019-09-11T10:23:33.051Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog guide you to push any basic images from docker hub to ECR and use that images in ECS using AWS Fargate for building containerize application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yT4RBerwLIC_J7Gu.png" /><figcaption>ECS architecture flow</figcaption></figure><h3>Key components</h3><ol><li>AWS ECS</li><li>AWS ECR</li><li>AWS Fargate</li><li>Docker</li></ol><h3>What is ECS(Elastic Container Service)?</h3><p>Amazon Elastic Container Service (Amazon ECS) is a highly scalable, high-performance <a href="https://aws.amazon.com/containers/">container</a> orchestration service that supports <a href="https://aws.amazon.com/docker/">Docker</a> containers and allows you to easily run and scale containerized applications on AWS. Amazon ECS eliminates the need for you to install and operate your own container orchestration software, manage and scale a cluster of virtual machines, or schedule containers on those virtual machines.</p><p>With simple API calls, you can launch and stop Docker-enabled applications, query the complete state of your application, and access many familiar features such as IAM roles, security groups, load balancers, Amazon CloudWatch Events, AWS CloudFormation templates, and AWS CloudTrail logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*PTfObb_xR2DJeb-uR4PvpA.png" /></figure><h3>What is ECR(Elastic Container Registry)?</h3><p>Amazon Elastic Container Registry (ECR) is a fully-managed <a href="https://aws.amazon.com/docker/">Docker</a> container registry that makes it easy for developers to store, manage, and deploy Docker container images. Amazon ECR is integrated with <a href="https://aws.amazon.com/ecs/">Amazon Elastic Container Service (ECS)</a>, simplifying your development to production workflow. Amazon ECR eliminates the need to operate your own container repositories or worry about scaling the underlying infrastructure. Amazon ECR hosts your images in a highly available and scalable architecture, allowing you to reliably deploy containers for your applications. Integration with AWS Identity and Access Management (IAM) provides resource-level control of each repository. With Amazon ECR, there are no upfront fees or commitments. You pay only for the amount of data you store in your repositories and data transferred to the Internet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*LNefgW5h-a8oa3Jd.png" /></figure><h3>What is AWS Fargate?</h3><p>AWS Fargate is a compute engine for Amazon ECS that allows you to run <a href="http://aws.amazon.com/what-are-containers">containers</a> without having to manage servers or clusters. With AWS Fargate, you no longer have to provision, configure, and scale clusters of virtual machines to run containers. This removes the need to choose server types, decide when to scale your clusters, or optimize cluster packing. AWS Fargate removes the need for you to interact with or think about servers or clusters. Fargate lets you focus on designing and building your applications instead of managing the infrastructure that runs them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gZAQKL7bWba6opDM.jpeg" /></figure><h3>Summary of the ECS Terms</h3><p>First we need to cover ECS terminology:</p><ul><li>Task Definition — This a blueprint that describes how a docker container should launch. If you are already familiar with AWS, it is like a LaunchConfig except instead it is for a docker container instead of a instance. It contains settings like exposed port, docker image, cpu shares, memory requirement, command to run and environmental variables.</li><li>Task — This is a running container with the settings defined in the Task Definition. It can be thought of as an “instance” of a Task Definition.</li><li>Service — Defines long running tasks of the same Task Definition. This can be 1 running container or multiple running containers all using the same Task Definition.</li><li>Cluster — A logic group of EC2 instances. When an instance launches the ecs-agent software on the server registers the instance to an ECS Cluster. This is easily configurable by setting the ECS_CLUSTER variable in /etc/ecs/ecs.config described <a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_container_instance.html">here</a>.</li><li>Container Instance — This is just an EC2 instance that is part of an ECS Cluster and has docker and the <a href="https://github.com/aws/amazon-ecs-agent">ecs-agent</a> running on it.</li></ul><p>I remember when I first got introduced to the all the terms, I quickly got confused. AWS provides nice <a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html">detailed diagrams</a> to help explain the terms. Here is a simplified diagram to help visualize and explain the terms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/0*BD0GCd-DMiuZYWvb.png" /><figcaption>ECS Terms</figcaption></figure><p>In this diagram you can see that there are 4 running Tasks or Docker containers. They are part of an ECS Service. The Service and Tasks span 2 Container Instances. The Container Instances are part of a logical group called an ECS Cluster.</p><p>I did not show a Task Definition in the diagram because a Task is simply an “instance” of Task Definition.</p><h3>Step by step guide of ECS Configuration using ECR</h3><ol><li><strong>Create repository in ECR</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0lgd2rZ3TVjH1dVF36ffnw.png" /><figcaption>Created repository in ECR console</figcaption></figure><p><strong>2. Get login access to push docker image in ECR using AWS CLI</strong></p><p>Run the <strong>aws ecr get-login</strong> command. The example below is for the default registry associated with the account making the request. To access other account registries, use the --registry-ids <em>aws_account_id</em> option. For more information, see <a href="https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login.html">get-login</a> in the <em>AWS CLI Command Reference</em>.</p><blockquote>aws ecr get-login --region <em>region</em> --no-include-email</blockquote><p>Copy and paste the <strong>docker login</strong> command into a terminal to authenticate your Docker CLI to the registry. This command provides an authorization token that is valid for the specified registry for 12 hours.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o7y0kf7bdaoOM8mNNP652w.png" /><figcaption>Get login access for ECR</figcaption></figure><p><strong>3. Get a Docker Image</strong></p><p>Before you can push an image to Amazon ECR, you must have one to push. If you do not already have an image to use, you can create one by following the steps in <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/docker-basics.html">Docker Basics for Amazon ECR</a>. Or, pull an image from Docker Hub that you would like to have in your Amazon ECR registry. To pull the wordpress image from Docker Hub to your local system, run the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iCfFgn8Wqmn_Slxof_DbSw.png" /><figcaption>Pull docker wordpress image from docker hub</figcaption></figure><p><strong>4. Push an Image to Amazon ECR</strong></p><p>Now you can push your image to the Amazon ECR repository you created in the previous section. You use the <strong>docker</strong> CLI to push images, but there are a few prerequisites that must be satisfied for this to work properly:</p><ul><li>The minimum version of <strong>docker</strong> is installed: 1.7</li><li>The Amazon ECR authorization token has been configured with <strong>docker login</strong>.</li><li>The Amazon ECR repository exists and the user has access to push to the repository.</li></ul><p>After those prerequisites are met, you can push your image to your newly created repository in the default registry for your account.</p><p><strong>To tag and push an image to Amazon ECR</strong></p><p>List the images you have stored locally to identify the image to tag and push. Tag the image to push to your repository.</p><blockquote><strong>docker tag ubuntu:trusty </strong><strong><em>aws_account_id</em></strong><strong>.dkr.ecr.us-east-1.amazonaws.com/wordpress:latest</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XLVVRQ0d-BuxD_SV_lsglA.png" /><figcaption>Tag image</figcaption></figure><p>push the image</p><blockquote><strong>docker push </strong><strong><em>aws_account_id</em></strong><strong>.dkr.ecr.us-east-1.amazonaws.com/wordpress:latest</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*REhZDxCyInltMV8oUi1PNg.png" /><figcaption>Push image to ECR</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sdW0pQFz9yJ_iAB06RhPuQ.png" /><figcaption>Image in ECR repository</figcaption></figure><p><strong>5. Create custom cluster in ECS</strong></p><p>Select custom cluster using manually configuration by providing ECR repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BxHC2SaIM-CJGHkXNxM6XQ.png" /><figcaption>Custom cluster</figcaption></figure><p>Create container from ECR repository</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2_jdDhtJceQym2DCYnXg2A.png" /><figcaption>Create container</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P-ai1oXoOsA6nkT8v38SHQ.png" /></figure><p>Review cluster</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvvEYhxF1ugPRsVqIQX1BA.png" /><figcaption>Review page</figcaption></figure><p>Cluster create</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XOcX6RVN14qePp8EwOFvLw.png" /><figcaption>Cluster creation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p2WgyojDiYNe_f1H6FGQKg.png" /></figure><p>Task Definition provide task to cluster to launch docker image in cluster</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d6-iEwRkIIMAjZ0GixSu2w.png" /><figcaption>Task creation</figcaption></figure><p>Open wordpress site using public DNS of load balance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zVAQsCSoClCwEAPimVrx5A.png" /><figcaption>Wordpress configuration</figcaption></figure><h3>Clean up:</h3><p>It is quickest to use the AWS Console to delete the following resources:</p><ul><li>ELB</li><li>ECS Cluster</li><li>CloudFormation stack</li><li>VPC</li></ul><h3>Conclusion:</h3><p>You can scale cluster by updating task and changing running version of task.</p><p>Overall, I think that ECS is a pretty amazing service and it has taken the hassle of managing docker orchestration and provisioning responsibility away.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c1e97d05aaa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/petabytz/amazon-web-services-wordpress-configuration-on-ecs-using-ecr-images-9c1e97d05aaa">Amazon web services: Wordpress configuration on ECS using ECR images</a> was originally published in <a href="https://medium.com/petabytz">Petabytz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Cloud DataProc : Launch Hadoop-Hive-Spark Cluster in Google Cloud Platform(GCP)]]></title>
            <link>https://medium.com/petabytz/google-cloud-dataproc-launch-hadoop-hive-spark-cluster-in-google-cloud-platform-gcp-420302c77210?source=rss-3996b8ee8f4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/420302c77210</guid>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[hive]]></category>
            <category><![CDATA[hadoop]]></category>
            <category><![CDATA[gcp]]></category>
            <dc:creator><![CDATA[Harsh Muniwala]]></dc:creator>
            <pubDate>Tue, 10 Sep 2019 08:50:12 GMT</pubDate>
            <atom:updated>2019-09-10T08:51:55.794Z</atom:updated>
            <content:encoded><![CDATA[<h3>Google Cloud DataProc : Launch Hadoop-Hive-Spark Cluster in Google Cloud Platform(GCP)</h3><h3>What is Spark?</h3><p>Apache Spark is a <em>fast and general purpose engine for large-scale data processing</em>. You can write code in Scala or Python and it will automatically parallelize itself on top of Hadoop. It basically runs map/reduce.</p><h3>What is Hadoop and HDFS?</h3><p>Hadoop is a software library, which is a <em>framework that allows for the distributed processing of large data sets across clusters of computers using simple programming models</em>. It’s really a common library called <em>Hadoop Common</em> and a framework called <em>Hadoop MapReduce</em> that sits on top of a distributed file system, called HDFS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*RJOBqnE5LxX3hZlPH0MWXA.png" /></figure><h3>What is Yarn?</h3><p>The <em>Hadoop Distributed File System</em> or <em>HDFS</em> is a way to distribute file system data to a bunch of workers. The distribution, job scheduling and cluster resource management is done by a system called <em>Yarn</em>.</p><h3>What is Hive?</h3><p>Hadoop alone doesn’t know much about data structure and deals with text files. Most humans work with SQL, so the Apache <em>Hive</em> data warehouse software <em>facilitates reading, writing, and managing large datasets residing in distributed HDFS storage using SQL</em>. It lets you create and query a SQL schema on top of text files, which can be in various formats, including the usual CSV or JSON.</p><h3><strong>What is DataProc?</strong></h3><p>Cloud Dataproc is a managed Spark and Hadoop service that lets you take advantage of open source data tools for batch processing, querying, streaming, and machine learning. Cloud Dataproc automation helps you create clusters quickly, manage them easily, and save money by turning clusters off when you don’t need them. With less time and money spent on administration, you can focus on your jobs and your data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*0CVtQ-9TFVRWS-_w60W81w.png" /></figure><h3>Lunch Hadoop-Hive-Spark in GCP:</h3><p>Launching a Hadoop cluster can be a daunting task. It demands more than a day per node to launch a working cluster or a day to set up the Local VM Sandbox. VM Sandbox is highly susceptible to frequent crashes and corruption every now and then. We can leverage the cloud platform to solve this problem. This will make the developer’s life a little easier.</p><p>Google Cloud Dataproc is Google’s version of the Hadoop ecosystem. It includes the Hadoop Distributed File System (HDFS) and Map/Reduce processing framework. The Google Cloud Dataproc system also includes a number of applications such as Hive, Mahout, Pig, Spark, and Hue built on top of Hadoop.</p><p>In this blog, we will see how to set up DataProc on GCP. There are two ways to create DataProc Cluster; one is using the UI wizard and the second is using the REST/CURL command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*giqYWElpKslK6GB_T4Jo2A.png" /><figcaption>Dataproc Concept</figcaption></figure><h2>Steps to Setup Google DataProc :</h2><ol><li>Click on the <strong>Menu</strong> and navigate to <strong>Dataproc</strong> under the <strong>BIG DATA</strong> section</li><li>Click the <strong>Create</strong> cluster button</li><li>Give the cluster a name</li><li><strong>Optional Step</strong> — Create a <strong>Cloud Storage staging bucket </strong>to stage files such as Hadoop jars, between client machines and the cluster. If not specified, it uses a default bucket</li><li><strong>Optional Step</strong> — Create a <strong>Network for the Data Proc cluster</strong> which will be used by the Compute Engine. If not specified, the default network will be chosen for you</li><li>Set your specific Machine type for your <strong>Master node(s)</strong> and Primary disk size (For dev config =&gt;<strong>disk size:100 GB and RAM:18 GB</strong>)</li><li>Set your specific Machine type for your <strong>Worker node(s)</strong> and specify how many nodes you require (For dev config =&gt; <strong>2 Worker nodes, disk size:100 GB and RAM:12 GB</strong>)</li><li>Click on the <strong>Create</strong> button to create the cluster when you are done</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ef0bWaPNS6-L7xFSd3oIjQ.png" /><figcaption>Creating Network for Data Proc Cluster</figcaption></figure><h3>Creating DataProc Cluster using Web UI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*xZe2LSjUmAFq-bWBligVuA.png" /><figcaption>Cluster creation in dataproc</figcaption></figure><h3>Creating DataProc Cluster using Curl Command:</h3><blockquote><em>gcloud dataproc clusters create hadoop-hive-spark-dev-local-cluster — region us-west1 — subnet default — zone us-west1-a — master-machine-type custom-6–18432 — master-boot-disk-size 100 — num-workers 2 — worker-machine-type custom-4–12288 — worker-boot-disk-size 100 — num-worker-local-ssds 1 — image-version 1.3 — scopes ‘</em><a href="https://www.googleapis.com/auth/cloud-platform"><em>https://www.googleapis.com/auth/cloud-platform</em></a><em>&#39; — project hdp-multi-node-cluster-207321</em></blockquote><h3>Accessing Name Node and RM UI:</h3><ol><li><a href="http://xx.xx.xx.xx:8088/cluster">http://YOUR-CLUSTER-IP-ADDRESS:8088/cluster</a> (Change External IP with your VM Instance External IP)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MfSZ6HV9RGn0I6urp-xmpg.png" /><figcaption>Resource Manager</figcaption></figure><p>2. <a href="http://xx.xx.xx.xx:9870/dfshealth.html#tab-datanode">http://</a><a href="http://xx.xx.xx.xx:8088/cluster">YOUR-CLUSTER-IP-ADDRESS</a><a href="http://xx.xx.xx.xx:9870/dfshealth.html#tab-datanode">:9870/dfshealth.html#tab-namenode</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Cjwsx9I40_Og4-vqQMo0Q.png" /><figcaption><strong>Name Node UI</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*wFAFZ1ua5qZhSnOKJGHPrA.png" /></figure><h3><strong>Conclusion:</strong></h3><p>Cloud Dataproc is a managed Spark and Hadoop service that lets you take advantage of open source data tools for batch processing, querying, streaming, and machine learning. Cloud Dataproc automation helps you create clusters quickly, manage them easily, and save money by turning clusters off when you don’t need them. With less time and money spent on administration, you can focus on your jobs and your data.</p><h4>Limitations of DataProc:</h4><ol><li>No choice of selecting a specific version of Hadoop/hive/spark stack</li><li>You cannot pause/stop Data Proc Cluster</li><li>No UI for managing cluster-specific configuration like Ambari/Cloudera Manager</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=420302c77210" width="1" height="1" alt=""><hr><p><a href="https://medium.com/petabytz/google-cloud-dataproc-launch-hadoop-hive-spark-cluster-in-google-cloud-platform-gcp-420302c77210">Google Cloud DataProc : Launch Hadoop-Hive-Spark Cluster in Google Cloud Platform(GCP)</a> was originally published in <a href="https://medium.com/petabytz">Petabytz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazon Web Services : Using EC2 to Build a Video Chat Recording Service.]]></title>
            <link>https://medium.com/petabytz/amazon-web-services-using-ec2-to-build-a-video-chat-recording-service-16a1bf455566?source=rss-3996b8ee8f4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/16a1bf455566</guid>
            <category><![CDATA[video-recording]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <dc:creator><![CDATA[Harsh Muniwala]]></dc:creator>
            <pubDate>Sat, 27 Jul 2019 11:37:26 GMT</pubDate>
            <atom:updated>2019-07-29T14:21:34.699Z</atom:updated>
            <content:encoded><![CDATA[<h3>Amazon Web Services : Using EC2 to Build a Video Chat Recording Service.</h3><p>You’ll continue to use vidcall SDK to add group video chat to your web/mobile/desktop application — no changes required there. However, if you want to take advantage of recording, broadcast, or interoperability , you can incorporate the media bridge into your application. As the name suggests, the media bridge allows you to build a bridge from your vidcall video conference to other destinations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DHk37TWW1WIveJYnAe7WFA.jpeg" /></figure><h3>Step 1. Set Up AWS EC2 to Run the Media Bridge</h3><p>Docker is in no way, shape, or form limited to AWS, and you can deploy it on any Linux, Windows, or other popular cloud server service. I picked AWS because it’s one of the most popular cloud services, it offers a <a href="https://aws.amazon.com/free/">free tier</a> so you can try the setup at no cost, and it provides first-class Docker support via the <a href="https://aws.amazon.com/ecs/">EC2 Container Service</a> (ECS), which can be easily scaled to meet your demands.</p><ul><li>To get started, log in to your <a href="https://console.aws.amazon.com/console/home">AWS Console</a>, click the “EC2” link to go to the <a href="https://console.aws.amazon.com/ec2/v2/home">EC2 Console</a>, and click the blue “Launch Instance” button.</li><li>Select the Amazon Linux machine, which is eligible for the free tier. You’ll see in the description that it already includes some useful command line tools and the Docker repository.</li><li>Next, for the instance type, choose x1e.32xlarge.</li><li>For our media bridge to connect to a video conference call and receive media packets we’ll enable all the ports for TCP and UDP. Let’s create a new security group, give it a name, and add all TCP and UDP traffic.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vIYJb0pJhN39A6zPiHbpkw.png" /></figure><ul><li>Click the blue “Review and Launch” button.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*i4KYUECccrWCeGKXAjpMhg.png" /></figure><ul><li>If everything looks good, you’re now ready to connect to your cloud server to deploy the media bridge instance.</li></ul><h3>Step 2. Deploying the Media Bridge</h3><p>To deploy the media bridge on our EC2 instance, we’ll first connect to our instance using SSH.</p><p>For Linux user:</p><p>Open a terminal and go to the folder where you saved your key pair. Set read-only access to the key pair file using chmod:</p><blockquote>$ chmod 400 vediorecorder.pem</blockquote><blockquote>$ ssh -i ec2-key-pair.pem ec2-user@&lt;EC2-INSTANCE-PUBLIC-IP-ADDRESS&gt;</blockquote><p>For Windows user:</p><p>Windows use can directly connect using PuTTY.</p><p>To install Docker, run the following command:</p><blockquote>sudo yum update -y<br>sudo yum install -y docker<br>sudo service docker start</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ao8BUMXH9zl3rO1OAiZvQg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*zNR5hGXGe9wRSA6jcmSz8Q.png" /></figure><p>Once Docker is installed, you can pull the latest media bridge version and run a container with the following commands:</p><blockquote>sudo docker pull vidcall/mediabridge</blockquote><blockquote>sudo docker run -d — name my_mediabridge vidcall/mediabridge</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*QnBLlbxTa0gxJjsZ-jNA_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*9ggztFlxBI24qWNrTIifYA.png" /></figure><h3>Step 3. Create a Simple Web Service</h3><p>Now you have the media bridge instance deployed and you’re almost ready to connect to a call.</p><p>Before it can connect it needs three things:</p><ol><li>A valid token</li><li>The name of the resourceId to connect to</li><li>A destination, whether it is going to record, stream, or connect to a SIP gateway</li></ol><p>We’re going to create a web service using python and web.py. Note that we need to install the dependencies inside the my_mediabridge container that we created in the previous step. To do that you can run bash to get to the container shell:</p><blockquote>sudo docker exec -i -t my_mediabridge bash</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*hFIasGy1_uWS_q1WUBPFJg.png" /></figure><p>Now that you’re in your container, install web-py to this Docker image:</p><blockquote>apt-get update <br>apt-get install -y python python-webpy vim</blockquote><p>Within the container, create a new python script:</p><blockquote>mkdir /home/webapp<br>vim /home/webapp/app.py</blockquote><p><strong>app.py</strong></p><blockquote><em>#!/usr/bin/python</em><br>import web,sys<br>import os<br>import urllib2<br>import base64<br>import binascii<br>from datetime import datetime<br>import calendar, time<br>import hashlib<br>import hmac<br>import sys<br>import random</blockquote><blockquote>urls = (<br> ‘/record/(.*)’, ‘record’<br> )<br>app = web.application(urls, globals())</blockquote><blockquote><em># Developer specific parameters copy it from your </em>vidcall<em>.io dashboard</em><br><em># </em><a href="https://developer.vidyo.io/dashboard"><em>https://developer.</em></a>vidcall<a href="https://developer.vidyo.io/dashboard"><em>.io/dashboard</em></a></blockquote><blockquote>VIDYO_IO_DEVELOPER_KEY = “your key”<br>VIDYO_IO_APPLICATION_ID = “your application id”<br>TOKEN_VALID_DURATION_SECS = 600<br>EPOCH_SECONDS = 62167219200</blockquote><blockquote>def getVidyoIOToken():<br> type = ‘provision’<br> key = VIDYO_IO_DEVELOPER_KEY<br> jid = “recorder@” + VIDYO_IO_APPLICATION_ID<br> expires = TOKEN_VALID_DURATION_SECS + EPOCH_SECONDS + int(time.mktime(datetime.now().timetuple()))<br> vCard = “”</blockquote><blockquote>def to_bytes(o):<br> return str(o).encode(“utf-8”)</blockquote><blockquote>sep = b”\0&quot; <em># Separator is a NULL character</em><br> body = to_bytes(type) + sep + to_bytes(jid) + sep + to_bytes(expires) + sep + to_bytes(vCard)<br> mac = hmac.new(bytearray(key, ‘utf8’), msg=body, digestmod=hashlib.sha384).digest()<br> <em>## Combine the body with the hex version of the mac</em><br> serialized = body + sep + binascii.hexlify(mac)<br> b64 = base64.b64encode(serialized)<br> token = b64.encode(“utf8”)<br> encoded_token = urllib2.quote(token)<br> return encoded_token;</blockquote><blockquote>class record:<br> def GET(self, roomId):<br> encoded_token = getVidyoIOToken()<br> os.system (“cp /home/webapp/config /opt/vidcall”)<br> with open(“/opt/vidcall/config”, “a”) as myfile:<br> myfile.write(“resourceId=”%s”\n” % (roomId))<br> myfile.write(“token=”%s”\n” % (encoded_token))<br> os.system (“/opt/vidcall/connect &amp;”)<br> return roomId</blockquote><blockquote>if __name__ == ‘__main__’ :<br> app = web.application(urls, globals())<br> app.run()</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bt1r-UqfcLpFCN_gsdQbKw.png" /></figure><p>Create a sample config file in the webapp folder:</p><blockquote>vim /home/webapp/config</blockquote><p><strong>Config:</strong></p><blockquote>##main video/audio settings<br>width=1280<br>height=720<br>fps=30<br>kbps=2000<br>layout=1<br>maxParticipants=8<br>overlay=1<br>videoCodec=H264<br>audioCodec=PCM<br>maxCallDuration=1000</blockquote><blockquote>#Presentation settings<br>presentationAllowed=1 #0 — ignore presentations 1 — replace main video with presentation<br>presWidth=1280<br>presHeight=720<br>presFps=5<br>presKbps=300<br>destination=”flv:/opt/vidcall/recording.flv”<br>log=error</blockquote><blockquote>#vidcall.io connection info<br>host=”prod.vidcall.io”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*PVKTEYJwGNN-i7qHKVdyZA.png" /></figure><p>Now that we have everything set up in our container, let’s go back to the EC2 instance:</p><blockquote>exit</blockquote><p>We’ll create a new image from the Docker container we just modified and name it “simple_record_ws”:</p><blockquote>sudo docker commit my_mediabridge simple_record_ws:0.1</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*FS_Hnkv5Xl5xxlgmn1wJfw.png" /></figure><p>Finally, start your web service by calling:</p><blockquote>sudo docker run -d -p 80:5000 — name my_vidcallmbws simple_record_ws:0.1 python /home/webapp/app.py 5000</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tqxFV9dcgw3Hbhr_Jb8E5Q.png" /></figure><h3>Step 4. Testing Your New Web App</h3><p>We have now successfully deployed the media bridge on the cloud, and it’s just waiting for someone to call it with the record command so that it can start recording a video conference. Let’s test it out.</p><p>Go to <a href="https://developer.vidyo.io/demo">https://developer.</a>vidcall<a href="https://developer.vidyo.io/demo">.io/demo</a> and launch an instance. Note that you should be signed in to the same account you used to copy the developer key and app Id values.</p><p>By default the demo sample on the demo page joins the room named demoRoom. Try signing in from different machines so you have multiple participants on the call.</p><p>Copy your EC2 instance public IP address, open a browser, and enter the following:</p><p><a href="http://ec2-instance-public-ip-address/record/demoRoom">http://EC2-INSTANCE-PUBLIC-IP-ADDRESS/record/demoRoom</a></p><p>A page will open with the text “demoRoom,” but, more importantly, you’ll notice on your video conference a message that Recorder/Streamer has joined.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*__y8XY2vFNATDy9IDP_M6g.png" /></figure><p>Your recorder is working. Once every participant leaves the call, the recorder will automatically stop. You can copy the recording:</p><blockquote>sudo docker cp my_mediabridge:/opt/vidcall/recording.flv</blockquote><p>Open another terminal in the same folder where your key pair is and copy the recording from your EC2 instance to your local computer using the following command:</p><blockquote>scp -i ec2-keypair.pem ec2-user@EC2-INSTANCE-PUBLIC-IP:~/recording.flv .</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hDa40qYCNgbA6vzzj2cYSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hWYXUD2QMjtkOEW7eKDVdA.png" /></figure><h3>Conclusion :</h3><p>You’ve built a simple web service that will record your vidcall conferences on command. One of the cool things about using the EC2 service from Amazon is that you can easily scale your service to deploy multiple containers on demand to record or stream a number of conferences in parallel. In our example we deployed one container to record one conference, but you can use Amazon’s cluster service<a href="https://console.aws.amazon.com/ecs/home"> ECS Console</a> to manage your containers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16a1bf455566" width="1" height="1" alt=""><hr><p><a href="https://medium.com/petabytz/amazon-web-services-using-ec2-to-build-a-video-chat-recording-service-16a1bf455566">Amazon Web Services : Using EC2 to Build a Video Chat Recording Service.</a> was originally published in <a href="https://medium.com/petabytz">Petabytz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wordpress Website Database Migration from AWS to GCP]]></title>
            <link>https://medium.com/petabytz/wordpress-website-database-migration-from-aws-to-gcp-1c327f563a32?source=rss-3996b8ee8f4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c327f563a32</guid>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[web-migration]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Harsh Muniwala]]></dc:creator>
            <pubDate>Tue, 23 Jul 2019 09:37:08 GMT</pubDate>
            <atom:updated>2019-07-23T09:37:08.591Z</atom:updated>
            <content:encoded><![CDATA[<h3>Prerequisites</h3><ul><li>Wordpress is required in both AWS Ec2 instance and GCP Compute Engine instance.</li></ul><h3>In Google Cloud Platform</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-WFS4mN4Q5GfzHCE.png" /></figure><h3>In Amazon Web Service</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_Ka8-Qsrk6j_GahI.png" /></figure><ul><li>We installed in both using shell script</li></ul><pre>#!/bin/bash<br>yum update -y<br>yum upgrade -y<br>yum install wget zip unzip -y<br>yum install httpd -y<br>yum groupinstall Mariadb Mariadb-client -y<br>yum install php -y<br>systemctl restart httpd<br>systemctl enable httpd<br>wget <a href="https://wordpress.org/latest.zip">https://wordpress.org/latest.zip</a><br>unzip -d /var/www/html/ latest.zip<br>mv /var/www/html/wordpress/* /var/www/html/<br>restorecon -Rv /var/www/</pre><pre>mysql -u root &lt;&lt;MYSQL_SCRIPT<br>CREATE DATABASE wordpress;<br>CREATE USER &#39;wordpress&#39;@&#39;localhost&#39; IDENTIFIED BY &#39;wordpress123&#39;;<br>GRANT ALL PRIVILEGES ON wordpress.* TO &#39;wordpress&#39;@&#39;localhost&#39;;<br>FLUSH PRIVILEGES;<br>MYSQL_SCRIPT</pre><pre>systemctl restart mariadb<br>systemctl enable mariadb<br>firewall-cmd --permanent --add-service={http,https}<br>fireall-cmd --reload</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uZCeMA7yGEF6VSSj.png" /></figure><blockquote>Note : This is script for Redhat 7 OS instance. If you are using different OS then you have to modify according to that in this file.</blockquote><ul><li>Installation process of wordpress</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GH4r3PHNA9-TeBs4.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yNOPfe09_SrnF7hA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eeQ8GkNfJf_5jlzw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gu-9th2NFPmI6Nna.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PTs62s3g1IwUknx8.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*p94WXaP889erttR6.png" /></figure><h3>Migration Process</h3><h3>1. Created Multiple users in AWS Ec2 instance wordpress site.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i4bm9PQfFJX8Dff5.png" /></figure><h3>2. Reviewing Database</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m-qv8zhdIG4X7Qt0.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UxhSHrfBdvy8PaIT.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AbOXmxK9FtBejHos.png" /></figure><h3>3. Creating Database dump file for migrating database</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cgSuGs4Sbr7nTACN.png" /></figure><h3>4. Users Table data in Compute Engine is different from Ec2.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KECB5NCVQDBPjgx3.png" /></figure><h3>5. Uploaded that database file from Ec2 instance to GCP Cloud Storage.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KtG89x6E8GOcnMo3.png" /></figure><h3>6. Getting file from Cloud Storage to GCP Compute Engine</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SESZMLIsF5_KygaJ.png" /></figure><h3>7. Updating database of GCP wordpress website</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O1YCuXdJcfGIE6zN.png" /></figure><h3>8. Successfully Migrated Database of wordpress site from AWS to GCP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*daevp3abmC7iNMqz.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c327f563a32" width="1" height="1" alt=""><hr><p><a href="https://medium.com/petabytz/wordpress-website-database-migration-from-aws-to-gcp-1c327f563a32">Wordpress Website Database Migration from AWS to GCP</a> was originally published in <a href="https://medium.com/petabytz">Petabytz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VM Migration : AWS to GCP by cloudendure]]></title>
            <link>https://medium.com/petabytz/vm-migration-aws-to-gcp-by-cloudendure-6744828a2bb5?source=rss-3996b8ee8f4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6744828a2bb5</guid>
            <category><![CDATA[vm-migration]]></category>
            <category><![CDATA[cloudendure]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[migration]]></category>
            <dc:creator><![CDATA[Harsh Muniwala]]></dc:creator>
            <pubDate>Thu, 18 Jul 2019 14:40:45 GMT</pubDate>
            <atom:updated>2019-07-19T07:28:42.401Z</atom:updated>
            <content:encoded><![CDATA[<h3>VM Migration : AWS to GCP by Cloudendure</h3><h3>Prerequisites</h3><p>Both AWS and GCP Accounts required.</p><p>First make sure you must have an EC2 instance with small application installed in it.</p><p>here, In EC2 instance apache2 is installed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AXIMbmObWwpbP9ES.png" /></figure><h3>Cloudendure Configuration</h3><p>Cloudendure is used for VM migration. It is agent base migration tool so you have to install an agent in VM that will be migrated.</p><ul><li>Go to Compute Engine in GCP Console.</li><li>Click on Import VM.</li><li>Once you click on that you find the bellow screen</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9uTYiMz_Et3XSXQ4.png" /></figure><ul><li>Click on Cloudendure</li><li>Login in this using you GCP account</li><li>Click on create new project or you can use default project.</li></ul><p>Note: Cloudendure and GCP projects are different from each other so you can set any name for project it will not effect your GCP account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*imifZg8ZxfSvVfty.png" /></figure><ul><li>Enter your GCP project id</li><li>Enter Service Account private key in Google Cloud Platform JSON Private Key</li><li>You can get that from GCP Console -&gt; APIs &amp; Services -&gt; Credentials</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zv3OqAS6Uz0QeBTX.png" /></figure><ul><li>Create Credentials for Service Account</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-NN-EUmN2GS4jssN.png" /></figure><ul><li>Select Compute Engine default service account</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J37nd0G-5HSEfnc5.png" /></figure><ul><li>After creating credentials it will automatically download JSON file. Open that JSON file in Cloudendure Console for private key</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JFVc4iv1S7SJ2fGS.png" /></figure><ul><li>Next enter details to where you want to create you Compute Engine</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X2mQACLpOC3gZJ6L.png" /></figure><h3>NOTE : Here is one option Use VPN or Cloud interconnect. If we not enable this then it use public internet to migrate our VM, so it slow down the process of migration. So we can use VPN connected with AWS VPC via tunnel then it will do secure and fast migration.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oV0naw354oplykxO.png" /></figure><ul><li>Setup is completed</li><li>Install Cloudendure agent on AWS EC2 using given configuration.</li><li>Since we using Linux instance on EC2 so we use linux configuration.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RAuEo7l_644x0EPw.png" /></figure><ul><li>Downloading agent in EC2 instance</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6KxA-EVxxpfDhsCv.png" /></figure><ul><li>Execute using next command to verify the cloudendure in EC2</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tm4xwskM4IZ88ERv.png" /></figure><ul><li>Back to the Cloudendure console you can see the process of data replication has just started. It take 25–30 minutes to replicate because we using public internet for migrating the VM.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z93hhMHjIhAtgTz7.png" /></figure><ul><li>Once Replication is completed you have to create Blueprint for configuration of machine of GCP</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lePJPF8YzpAaNpaP.png" /></figure><ul><li>Now click on LAUNCH TARGET MACHINE you will see there is 2 option:</li></ul><ol><li>Test Mode : When you launch target machine in test mode you can do continuous data replication from AWS to GCP.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YBSibF07fLMKp44q.png" /></figure><p>2. Cutover : In this mode you have no further contact with your AWS instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*48A9ecz_ACBScGM7.png" /></figure><ul><li>Here we launch machine in Test mode.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wQ5nxA3QND9Rsu_N.png" /></figure><ul><li>You can see progress in Job Progress</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ak2_47rcb-dAi8Hb.png" /></figure><ul><li>After a few minutes you can see 2 instance is launched in your GCP console.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hF3CvjKEMMMXHc1M.png" /></figure><p>the one is our actual VM which is migrated from AWS and another one is Cloudendure replicator, since we are doing in Test mode so it create replicator, if you launch in cutover mode you will not find that instance.</p><ul><li>This is migrated VM on GCP</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*A14msXLDRhC7iTqq.png" /></figure><ul><li>If you want to ssh in GCP instance you can not directly do that by clicking on ssh button, you have to use PUTTY or SSH client to connect to that instance using same ssh key which is generated form AWS EC2 instance.</li></ul><h3><strong>Conclusion</strong> :</h3><p>As you can see, cloud migration is quite a doable endeavor, if it is executed according to a straightforward checklist. However, there are multiple underwater reefs that pose a grave danger for the project.</p><p>Thus said, cloud migration is one of the most popular services provided by reliable Managed Services Providers worldwide. These companies have ample experience designing and implementing the cloud migration plans, allowing their customers reach the business goals set, optimize their product or services performance and deliver more value to their customers while spending less on their IT infrastructure maintenance.</p><p>Velostrata also provide cloud migration platform.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6744828a2bb5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/petabytz/vm-migration-aws-to-gcp-by-cloudendure-6744828a2bb5">VM Migration : AWS to GCP by cloudendure</a> was originally published in <a href="https://medium.com/petabytz">Petabytz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Database Migration : Migrating from DynamoDB to Google Cloud Spanner (Part 2)]]></title>
            <link>https://medium.com/petabytz/database-migration-migrating-from-dynamodb-to-google-cloud-spanner-part-2-643e564f8295?source=rss-3996b8ee8f4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/643e564f8295</guid>
            <category><![CDATA[cloud-spanner]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[dynamodb]]></category>
            <dc:creator><![CDATA[Harsh Muniwala]]></dc:creator>
            <pubDate>Fri, 28 Jun 2019 06:54:04 GMT</pubDate>
            <atom:updated>2019-06-28T06:54:04.746Z</atom:updated>
            <content:encoded><![CDATA[<h3>Database Migration : Migrating from DynamoDB to Google Cloud Spanner (Part 2)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*DIQEhwvJG0d8C2BZhxWgdw.png" /></figure><h3>Opening the database</h3><p>If you paused writes to the database before exporting, it’s time to reactivate writes to the database. Now that the Cloud Pub/Sub delivery is in place, you can push forward any table changes that occurred after the export.</p><h3>Copy the exported table to Cloud Storage</h3><ol><li>In Cloud Shell, create a Cloud Storage bucket to receive the exported files from Amazon S3.</li></ol><blockquote>gsutil mb gs://$BUCKET</blockquote><p>2. Sync the files from Amazon S3 into Cloud Storage. For most copy operations, the rsync command is effective. If your export files are large (several GBs or more), use the <a href="https://cloud.google.com/storage-transfer/docs/overview">Cloud Storage transfer service</a> to manage the transfer in the background.</p><blockquote>gsutil rsync -d -r s3://$BUCKET gs://$BUCKET</blockquote><p>The following output appears:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*mM_yFiNrJC11YSjX-IHHyQ.png" /></figure><h3>Batch import the data</h3><ol><li>To write the data from the exported files into the Cloud Spanner table, run a Cloud Dataflow job with sample Apache Beam code.</li></ol><blockquote>cd dataflow mvn compile mvn exec:java \ -Dexec.mainClass=com.example.spanner_migration.SpannerBulkWrite \ -Dexec.args=” — project=$GOOGLE_CLOUD_PROJECT \ — instanceId=spanner-migration \ — databaseId=migrationdb \ — table=Migration \ — importBucket=$BUCKET \ — runner=dataflow”</blockquote><p>2. To watch the progress of the import job, in the GCP Console, go to Cloud Dataflow.</p><p>3. While the job is running, you can watch the execution graph to examine the logs. Click the job that shows the <strong>Status</strong> of <strong>Running</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*54lvP0OTvQOGEXQPyBtqlw.png" /></figure><p>4. Click each stage to see how many elements have been processed. The import is complete when all stages say <strong>Succeeded</strong>. The same number of elements that were created in your Amazon DynamoDB table display as processed at each stage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*ltsx0jkyW9coOzqJeQ28EA.png" /></figure><p>5. Verify that the number of records in the destination Cloud Spanner table matches the number of items in the Amazon DynamoDB table.</p><blockquote>aws dynamodb describe-table — table-name Migration — query Table.ItemCount</blockquote><blockquote>gcloud spanner databases execute-sql migrationdb \<br> — instance=spanner-migration — sql=”select count(*) from Migration”</blockquote><p>6. Sample random entries in each table to make sure the data is consistent.</p><blockquote>gcloud spanner databases execute-sql migrationdb \<br> — instance=spanner-migration \<br> — sql=”select * from Migration limit 1&quot;</blockquote><p>7. Query the Amazon DynamoDB table with the same Username that was returned from the Cloud Spanner query in the previous step. For example, <strong>aallen2538</strong>. Your value is specific to your database.</p><blockquote>aws dynamodb get-item — table-name Migration \<br> — key ‘{“Username”: {“S”: “aallen2538”}}’</blockquote><p>The values of the other fields should match those from the Cloud Spanner output. The following output appears:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*-yVheSoWFBY-V4kbGqmXaw.png" /></figure><h3>Replicate new changes</h3><p>When the batch import job is complete, you set up a streaming job to write ongoing updates from the source table into Cloud Spanner. You <a href="https://cloud.google.com/pubsub/docs/subscriber">subscribe</a> to the events from Cloud Pub/Sub and write them to Cloud Spanner</p><p>The Lambda function you created is configured to capture changes to the source Amazon DynamoDB table and publish them to Cloud Pub/Sub.</p><ol><li>Create a subscription to the Cloud Pub/Sub topic that AWS Lambda sends events to.</li></ol><blockquote>gcloud pubsub subscriptions create spanner-migration \ — topic spanner-migration</blockquote><p>The following output appears:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*hKA-cemWBl7-KtjYK-vDpg.png" /></figure><p>2. To stream the changes coming into Cloud Pub/Sub to write to the Cloud Spanner table, run the Cloud Dataflow job from Cloud Shell.</p><blockquote>cd ~/dynamodb-spanner-migration/dataflow<br>mvn exec:java \<br> -Dexec.mainClass=com.example.spanner_migration.SpannerStreamingWrite \<br> -Dexec.args=” — project=$GOOGLE_CLOUD_PROJECT \<br> — instanceId=spanner-migration \<br> — databaseId=migrationdb \<br> — table=Migration \<br> — experiments=allow_non_updatable_job \<br> — subscription=projects/$GOOGLE_CLOUD_PROJECT/subscriptions/spanner-migration”</blockquote><p>a. Similar to the <a href="https://cloud.google.com/solutions/migrating-dynamodb-to-cloud-spanner#batch_import_the_data">batch load</a> step, to watch the progress of the job, in the GCP Console, go to Cloud Dataflow.</p><p>b. Click the job that has the <strong>Status</strong> of <strong>Running</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*vrFGGU3Nd6q27LQYYVQJng.png" /></figure><p>The processing graph shows a similar output as before, but each processed item is counted in the status window. The system lag time is a rough estimate of how much delay to expect before changes appear in the Cloud Spanner table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*yx4LyOSLVOySNaXUzBY0Dg.png" /></figure><p>The Cloud Dataflow job that you ran in the batch loading phase was a finite set of input, also known as a <em>bounded </em>dataset. This Cloud Dataflow job uses Cloud Pub/Sub as a streaming source and is considered <em>unbounded</em>. For more information about these two types of sources, review the section on PCollections in the <a href="https://beam.apache.org/documentation/programming-guide/#pcollections">Apache Beam programming guide</a>. The Cloud Dataflow job in this step is meant to stay active, so it doesn’t terminate when finished. The streaming Cloud Dataflow job remains in the <strong>Running</strong> status, instead of the <strong>Succeeded</strong> status.</p><h3>Verify replication</h3><p>You make some changes to the source table to verify that the changes are replicated to the Cloud Spanner table.</p><ol><li>Query a nonexistent row in Cloud Spanner.</li></ol><blockquote>gcloud spanner databases execute-sql migrationdb \ — instance=spanner-migration — sql=\ “SELECT * FROM Migration WHERE Username=’my-test-username’”</blockquote><p>2. Create a record in Amazon DynamoDB with the same key that you used in the Cloud Spanner query. If the command runs successfully, there is no output.</p><blockquote>aws dynamodb put-item \ — table-name Migration \ — item ‘{“Username” : {“S” : “my-test-username”}, “Subscribed” : {“BOOL” : false}}’</blockquote><p>3. Run the original query again to verify that the row is now in Cloud Spanner.</p><blockquote>gcloud spanner databases execute-sql migrationdb \ — instance=spanner-migration \ — sql=”SELECT * FROM Migration WHERE Username=’my-test-username’”</blockquote><p>The output shows the inserted row:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*MBPb4_56V39kiCCZQ8reXA.png" /></figure><p>4. Change some attributes in the original item and update the Amazon DynamoDB table.</p><blockquote>aws dynamodb update-item \<br> — table-name Migration \<br> — key ‘{“Username”: {“S”:”my-test-username”}}’ \<br> — update-expression “SET PointsEarned = :pts, Subscribed = :sub” \<br> — expression-attribute-values ‘{“:pts”: {“N”:”4500&quot;}, “:sub”: {“BOOL”:true}}’\<br> — return-values ALL_NEW</blockquote><p>The output appears as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*NCIURicxLbzMeH8CS119zA.png" /></figure><p>5. Verify that the changes are propagated to the Cloud Spanner table.</p><blockquote>gcloud spanner databases execute-sql migrationdb \<br> — instance=spanner-migration \<br> — sql=”SELECT * FROM Migration WHERE Username=’my-test-username’”</blockquote><p>The output appears as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*Ld-VgB2LhI4Csbyb63iwHA.png" /></figure><p>6. Delete the test item from the Amazon DynamoDB source table.</p><blockquote>aws dynamodb delete-item \ — table-name Migration \ — key ‘{“Username”: {“S”:”my-test-username”}}’</blockquote><p>7. Verify that the corresponding row is deleted from the Cloud Spanner table. When the change is propagated, the following command returns zero rows:</p><blockquote>gcloud spanner databases execute-sql migrationdb \ — instance=spanner-migration \ — sql=”SELECT * FROM Migration WHERE Username=’my-test-username’”</blockquote><h3>Using interleaved tables</h3><p>Cloud Spanner supports the concept of <a href="https://cloud.google.com/spanner/docs/schema-and-data-model#creating_a_hierarchy_of_interleaved_tables">interleaving tables</a>. This is a design model where a top-level item has several nested items that relate to that top-level item, such as a customer and their orders, or a player and their game scores. If your Amazon DynamoDB source table uses a primary key composed of a hash key and a range key, you can model an interleaved table schema as shown in the following diagram. This structure lets you efficiently query the interleaved table while joining fields in the parent table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*OAHWRPF0JxRUycvUyFz1KA.png" /></figure><p><strong>Apply secondary indexes</strong></p><p>It is a <a href="https://cloud.google.com/spanner/docs/bulk-loading#secondary-indexes">best practice</a> to apply secondary indexes to Cloud Spanner tables <em>after</em> you load the data. Now that replication is working, you set up a <a href="https://cloud.google.com/spanner/docs/secondary-indexes">secondary index</a> to speed up queries. Like Cloud Spanner tables, Cloud Spanner secondary indexes are fully consistent. They are <em>not</em> <a href="https://wikipedia.org/wiki/Eventual_consistency">eventually consistent</a>, which is common in many NoSQL databases. This feature can help simplify your app design</p><p>Run a query that doesn’t use any indexes. You are looking for the top <em>N</em> occurrences, given a particular column value. This is a common query in Amazon DynamoDB for database efficiency.</p><ol><li>Go to Cloud Spanner.</li><li>Click <strong>QUERY</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*qHtj_DeEDiwnuDSFHyb4wA.png" /></figure><p>3. In the <strong>Query</strong> field, enter the following query, and then click <strong>Run query</strong>.</p><blockquote>SELECT Username,PointsEarned FROM Migration<br> WHERE Subscribed=true AND<br> ReminderDate &gt; DATE_SUB(DATE(current_timestamp()), INTERVAL 3 DAY)</blockquote><p>After the query runs, click <strong>Explanation</strong> and take note of the <strong>Rows scanned</strong> versus <strong>Rows returned</strong>. Without an index, Cloud Spanner scans the entire table to return a small subset of data that matches the query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*E0AAdVEUbEXE0IsK7qWFHw.png" /></figure><p>4. If this represents a commonly occurring query, create a composite index on the Subscribed and ReminderDate columns. In the Cloud Spanner console, click <strong>Create Index</strong>.</p><p>5. Click to turn on <strong>Edit as Text</strong>.</p><p>6. In the <strong>DDL statements</strong>, enter the index definition.</p><blockquote>CREATE INDEX SubscribedDate ON Migration ( Subscribed, ReminderDate )</blockquote><p>7. To begin building the database in the background, click <strong>Create</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*mIFjo2oIrng79SEECdM4jQ.png" /></figure><p>8. After the index is created, run the query again and add the index.</p><blockquote>SELECT Username,PointsEarned FROM<br>Migration@{FORCE_INDEX=SubscribedDate}<br> WHERE Subscribed=true AND<br> ReminderDate &gt; DATE_SUB(DATE(current_timestamp()), INTERVAL 3 DAY)</blockquote><p>Examine the query explanation again. Notice that the number of <strong>Rows scanned</strong> has decreased. The <strong>Rows returned </strong>at each step matches the number returned by the query.</p><h3>Interleaved indexes</h3><p>You can set up interleaved indexes in Cloud Spanner. The secondary indexes discussed in the <a href="https://cloud.google.com/solutions/migrating-dynamodb-to-cloud-spanner#apply_secondary_indexes">previous section</a> are at the root of the database hierarchy, and they use indexes the same way as a conventional database. An interleaved index is within the context of its interleaved row. See <a href="https://cloud.google.com/spanner/docs/whitepapers/optimizing-schema-design#index_options">index options</a> for more details about where to apply interleaved indexes.</p><h3>Adjusting for your data model</h3><p>In order to adapt the migration portion of this tutorial to your own situation, modify your Apache Beam source files. It is important that you don’t change the source schema during the actual migration window, otherwise you can lose data.</p><ol><li>To parse incoming JSON and build mutations, use GSON. Adjust the JSON definition to match your data.</li></ol><pre>public static class Item implements Serializable {<br>    private Username Username;<br>    private PointsEarned PointsEarned;<br>    private Subscribed Subscribed;<br>    private ReminderDate ReminderDate;<br>    private Zipcode Zipcode;<br><br>}<br><br>public static class Username implements Serializable {<br>    private String s;<br><br>}<br><br>public static class PointsEarned implements Serializable {<br>    private String n;<br><br>}<br><br>public static class Subscribed implements Serializable {<br>    private String bOOL;<br><br>}<br><br>public static class ReminderDate implements Serializable {<br>    private String s;<br><br>}<br><br>public static class Zipcode implements Serializable {<br>    private String n;<br><br>}</pre><p>2. Adjust the corresponding JSON mapping.</p><pre>mutation.set(&quot;Username&quot;).to(item.Username.s);<br><br>Optional.ofNullable(item.Zipcode).ifPresent(x-&gt;{<br>    mutation.set(&quot;Zipcode&quot;).to(Integer.parseInt(x.n));<br>});<br><br>Optional.ofNullable(item.Subscribed).ifPresent(x-&gt;{<br>    mutation.set(&quot;Subscribed&quot;).to(Boolean.parseBoolean(x.bOOL));<br>});<br><br>Optional.ofNullable(item.ReminderDate).ifPresent(x-&gt;{<br>    mutation.set(&quot;ReminderDate&quot;).to(Date.parseDate(x.s));<br>});<br><br>Optional.ofNullable(item.PointsEarned).ifPresent(x-&gt;{<br>    mutation.set(&quot;PointsEarned&quot;).to(Integer.parseInt(x.n));<br>});</pre><p>In the previous steps, you modified the Apache Beam source code for bulk import. Modify the source code for the streaming part of the pipeline in a similar manner. Finally, adjust the table creation scripts, schemas, and indexes of your Cloud Spanner target database.</p><h3>Cleaning up</h3><p>To avoid incurring charges to your Google Cloud Platform account for the resources used in this tutorial delete the project.</p><p>Source: <a href="https://cloud.google.com/solutions/">https://cloud.google.com/solutions/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=643e564f8295" width="1" height="1" alt=""><hr><p><a href="https://medium.com/petabytz/database-migration-migrating-from-dynamodb-to-google-cloud-spanner-part-2-643e564f8295">Database Migration : Migrating from DynamoDB to Google Cloud Spanner (Part 2)</a> was originally published in <a href="https://medium.com/petabytz">Petabytz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Database Migration : Migrating from DynamoDB to Google Cloud Spanner (Part 1)]]></title>
            <link>https://medium.com/petabytz/database-migration-migrating-from-dynamodb-to-google-cloud-spanner-part-1-ab6b8828580d?source=rss-3996b8ee8f4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab6b8828580d</guid>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[cloud-spanner]]></category>
            <dc:creator><![CDATA[Harsh Muniwala]]></dc:creator>
            <pubDate>Thu, 27 Jun 2019 15:53:01 GMT</pubDate>
            <atom:updated>2019-06-28T06:52:47.017Z</atom:updated>
            <content:encoded><![CDATA[<h3>Database Migration : Migrating from DynamoDB to Google Cloud Spanner (Part 1)</h3><h3>Amazon DynamoDB</h3><p>Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. DynamoDB lets you offload the administrative burdens of operating and scaling a distributed database, so that you don’t have to worry about hardware provisioning, setup and configuration, replication, software patching, or cluster scaling. Also, DynamoDB offers encryption at rest, which eliminates the operational burden and complexity involved in protecting sensitive data. For more information, see DynamoDB Encryption at Rest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*PhnQn46cyx26Y-VX0HeAKA.png" /></figure><p>With DynamoDB, you can create database tables that can store and retrieve any amount of data, and serve any level of request traffic. You can scale up or scale down your tables’ throughput capacity without downtime or performance degradation, and use the AWS Management Console to monitor resource utilization and performance metrics.</p><h3>Google Cloud Spanner</h3><p>Google Cloud Spanner is a distributed relational database service that runs on Google Cloud. It is designed to support global online transaction processing deployments, SQL semantics, highly available horizontal scaling and transactional consistency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/0*zuzdGPwl5Uy_lKXz.png" /></figure><p>Interest in Google Cloud Spanner centers on the cloud database’s ability to provide both availability and consistency. These traits are usually considered at odds with each other, with data designers typically making tradeoffs to emphasize either availability or consistency. The trade-off has been described most vividly in the CAP Theorem, which underpinned a general move to NoSQL databases for availability and scalability in web and cloud systems. In pursuing both system availability and data consistency, Google Cloud Spanner combines SQL and NoSQL traits.</p><h3>How to Migrate from DynamoDB to Cloud Spanner</h3><p>It is primarily intended for app owners who want to move from a NoSQL system to Cloud Spanner, a fully relational, fault-tolerant, highly scalable SQL database system that supports transactions. If you have consistent Amazon DynamoDB table usage, in terms of types and layout, mapping to Cloud Spanner is straightforward. If your Amazon DynamoDB tables contain arbitrary data types and values, it might be simpler to move to other NoSQL services, such as <a href="https://cloud.google.com/datastore/">Cloud Datastore</a> or <a href="https://firebase.google.com/">Firebase</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*DIQEhwvJG0d8C2BZhxWgdw.png" /></figure><h3>Objectives</h3><ul><li>Migrate data from Amazon DynamoDB to Cloud Spanner.</li><li>Create a Cloud Spanner database and migration table.</li><li>Map a NoSQL schema to a relational schema.</li><li>Create and export a sample dataset that uses Amazon DynamoDB.</li><li>Transfer data between Amazon S3 and Cloud Storage.</li><li>Use Cloud Dataflow to load data into Cloud Spanner.</li></ul><h3>Costs</h3><p>This tutorial uses the following billable components of Google Cloud Platform:</p><ul><li>GKE</li><li>Cloud Pub/Sub</li><li>Cloud Storage</li><li>Cloud Dataflow</li></ul><p>Cloud Spanner charges are based on the number of node-hours and the amount of data stored during the monthly billing cycle.</p><p>In addition to GCP resources, this tutorial uses the following Amazon Web Services (AWS) resources:</p><ul><li>Amazon EMR</li><li>AWS Lambda</li><li>Amazon S3</li><li>Amazon DynamoDB</li></ul><p>These services are only needed during the migration process.</p><h3>Preparing environment</h3><p>In this tutorial, you run commands in Cloud Shell. Cloud Shell gives you access to the command line in GCP, and includes the Cloud SDK and other tools that you need for GCP development. Cloud Shell can take several minutes to initialize.</p><ol><li>Activate Cloud Shell.</li><li>Set the default Compute Engine zone. For example, us-central1-b. <br>(gcloud config set compute/zone us-central1-b)</li><li>Clone the GitHub repository containing the sample code. (git clone <a href="https://github.com/GoogleCloudPlatform/dynamodb-spanner-migration.git">https://github.com/GoogleCloudPlatform/dynamodb-spanner-migration.git</a>)</li><li>Go to the cloned directory. (cd dynamodb-spanner-migration)</li><li>Create a Python <a href="https://virtualenv.pypa.io/en/stable/">virtual environment</a>. (virtualenv — python python2 env)</li><li>Activate the virtual environment. (source env/bin/activate)</li><li>Install the required Python modules. (pip install -r requirements.txt)</li></ol><h3>Configuring AWS access</h3><p>In this tutorial, you create and delete Amazon DynamoDB tables, Amazon S3 buckets, and other resources. To access these resources, you first need to create the required AWS Identity and Access Management (IAM) permissions. You can use a test or sandbox AWS account to avoid affecting production resources in the same account.</p><p><strong>Create an AWS IAM role for AWS Lambda</strong></p><p>In this section, you create an AWS IAM role that AWS Lambda uses at a later step in the tutorial.</p><ol><li>In the AWS console, go to the <strong>IAM</strong> section, click <strong>Roles</strong>, and then select <strong>Create role</strong>.</li><li>Under <strong>Choose the service that will use this role</strong>, click <strong>Lambda</strong>, and then select <strong>Next:Permissions</strong>.</li><li>In the <strong>Policy Type</strong> box, enter AWSLambdaDynamoDBExecutionRole.</li><li>Select the <strong>AWSLambdaDynamoDBExecutionRole</strong> checkbox, and then click <strong>Next:Review</strong>.</li><li>In the <strong>Role name</strong> box, enter dynamodb-spanner-lambda-role, and then click <strong>Create role</strong>.</li></ol><h3>Create an AWS IAM user</h3><p>Follow these steps to create an AWS IAM user with programmatic access to AWS resources, which are used throughout the tutorial.</p><ol><li>While you are still in the <strong>IAM</strong> section of the AWS console, click <strong>Users</strong>, and then select <strong>Add User</strong>.</li><li>In the <strong>User name</strong> box, enter dynamodb-spanner-migration.</li><li>Under <strong>Access type</strong>, click <strong>Programmatic access</strong>.</li><li>Click <strong>Next: Permissions</strong>.</li><li>Click <strong>Attach existing policies directly</strong> and select the following two policies: ( AmazonDynamoDBFullAccesswithDataPipeline, AmazonS3FullAccess )</li><li>Click <strong>Next: Review</strong>, and then click <strong>Create user</strong>.</li><li>Click <strong>Show</strong> to view the credentials. The access key ID and secret access key are displayed for the newly created user. Leave this window open for now because the credentials are needed in the following section. Safely store these credentials because with them, you can make changes to your account and affect your environment. At the end of this tutorial, you can delete the IAM user.</li></ol><p><strong>Configure AWS command-line interface</strong></p><ol><li>In Cloud Shell, configure the AWS Command Line Interface (CLI). (aws configure)</li><li>The following output appears:</li></ol><blockquote>$ aws configure<br>AWS Access Key ID [None]: PASTE_YOUR_ACCESS_KEY_ID<br>AWS Secret Access Key [None]: PASTE_YOUR_SECRET_ACCESS_KEY<br>Default region name [None]: us-west-2<br>Default output format [None]:<br>user@project:~/dynamodb-spanner$</blockquote><ul><li>Enter the <strong>ACCESS KEY ID</strong> and <strong>SECRET ACCESS KEY</strong> from the AWS IAM account that you created.</li><li>In the <strong>Default region name</strong> field, enter us-west-2. Leave other fields at their default values.</li></ul><p>3. Close the AWS IAM console window.</p><h3>Preparing the Amazon DynamoDB table</h3><p>In the following section, you create an Amazon DynamoDB source table and populate it with data.</p><p>In Cloud Shell, create an Amazon DynamoDB table that uses the <a href="https://cloud.google.com/solutions/migrating-dynamodb-to-cloud-spanner#sample_table">sample table</a> attributes.</p><blockquote>aws dynamodb create-table — table-name Migration \ — attribute-definitions AttributeName=Username,AttributeType=S \ — key-schema AttributeName=Username,KeyType=HASH \ — provisioned-throughput ReadCapacityUnits=75,WriteCapacityUnits=75</blockquote><p>Verify that the table status is ACTIVE.</p><blockquote>aws dynamodb describe-table — table-name Migration \ — query ‘Table.TableStatus’</blockquote><p>Populate the table with sample data.</p><blockquote>python make-fake-data.py — table Migration — items 25000</blockquote><h3>Creating a Cloud Spanner database</h3><p>You create a single-node instance, which is appropriate for testing and the scope of this tutorial. For a production deployment, refer to the documentation for <a href="https://cloud.google.com/spanner/docs/instances#node_count">Cloud Spanner instances</a> to determine the appropriate node count to meet your database performance requirements.</p><p>In this example, you create a table schema at the same time as the database. It is also possible, and common, to carry out <a href="https://cloud.google.com/spanner/docs/gcloud-spanner#update_databases">schema updates</a> after you create the database.</p><p>Create a Cloud Spanner instance in the same region where you set the default Compute Engine zone. For example, us-central1.</p><blockquote>gcloud spanner instances create spanner-migration \ — config=regional-us-central1 — nodes=1 \ — description=”Migration Demo”</blockquote><p>Create a database in the Cloud Spanner instance along with the sample table.</p><blockquote>gcloud spanner databases create migrationdb \ — instance=spanner-migration \ — ddl “CREATE TABLE Migration ( \ Username STRING(1024) NOT NULL, \ PointsEarned INT64, \ ReminderDate DATE, \ Subscribed BOOL, \ Zipcode INT64, \ ) PRIMARY KEY (Username)”</blockquote><h3>Pausing the database</h3><p>The next sections show you how to export the Amazon DynamoDB source table and set Cloud Pub/Sub replication to capture any changes to the database that occur while you export it.</p><h3>Stream changes to Cloud Pub/Sub</h3><p>You use an AWS Lambda function to stream database changes to Cloud Pub/Sub.</p><ol><li>In Cloud Shell, enable Amazon DynamoDB streams on your source table. (aws dynamodb update-table — table-name Migration \ — stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES)</li><li>Set up a Cloud Pub/Sub topic to receive the changes.</li></ol><blockquote>gcloud pubsub topics create spanner-migration.</blockquote><p>The following output appears:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*yL6eT33hgkcGdBP54Ds5sw.png" /></figure><p>3. Create a Cloud IAM service account to push table updates to the Cloud Pub/Sub topic.</p><blockquote>gcloud iam service-accounts create spanner-migration \<br> — display-name=”Spanner Migration”</blockquote><p>The following output appears:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*hX0opQKyzEbsHjUO5C16pQ.png" /></figure><p>4. Create a Cloud IAM policy binding so that the service account has permission to publish to Cloud Pub/Sub. Replace<strong>GOOGLE_CLOUD_PROJECT</strong> with the name of your GCP project.</p><blockquote>gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT \<br> — role roles/pubsub.publisher \<br> — member serviceAccount:spanner-migration@$GOOGLE_CLOUD_PROJECT.iam.gserviceaccount.com</blockquote><p>The following output appears:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*3nYscspgLTVZdf7l9eWj-g.png" /></figure><p>5. Create credentials for the service account.</p><blockquote>gcloud iam service-accounts keys create credentials.json \<br> — iam-account spanner-migration@$GOOGLE_CLOUD_PROJECT.iam.gserviceaccount.com</blockquote><p>The following output appears:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*IVQM2zmNmz-pOqB2O3Z8bg.png" /></figure><p>6. Prepare and package the AWS Lambda function to push Amazon DynamoDB table changes to the Cloud Pub/Sub topic.</p><blockquote>pip install — ignore-installed — target=lambda-deps google-cloud-pubsub==0.35<br> cd lambda-deps; zip -r9 ../pubsub-lambda.zip *; cd -<br> zip -g pubsub-lambda.zip ddbpubsub.py</blockquote><p>7. Create a variable to capture the Amazon Resource Name (ARN) of the Lambda execution role that you created earlier.</p><blockquote>LAMBDA_ROLE=$(aws iam list-roles \ — query ‘Roles[?RoleName==`dynamodb-spanner-lambda-role`].[Arn]’ \ — output text)</blockquote><p>8. Use the pubsub-lambda.zip package to create the AWS Lambda function.</p><blockquote>aws lambda create-function — function-name dynamodb-spanner-lambda \ — runtime python2.7 — role $LAMBDA_ROLE \ — handler ddbpubsub.lambda_handler — zip fileb://pubsub-lambda.zip \ — environment Variables=”{SVCACCT=$(base64 -w 0 credentials.json),PROJECT=$GOOGLE_CLOUD_PROJECT,TOPIC=spanner-migration}”</blockquote><p>The following output appears:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*Sza7S97lJpiIS_OV4Yi6FA.png" /></figure><p>9. Create a variable to capture the ARN of the Amazon DynamoDB stream for your table.</p><blockquote>STREAMARN=$(aws dynamodb describe-table \ — table-name Migration \ — query “Table.LatestStreamArn” \ — output text)</blockquote><p>10. Attach the Lambda function to the Amazon DynamoDB table.</p><blockquote>aws lambda create-event-source-mapping — event-source $STREAMARN \ — function-name dynamodb-spanner-lambda — enabled \ — starting-position TRIM_HORIZON</blockquote><p>11. To optimize responsiveness during testing, add --batch-size 1 to the end of the previous command, which triggers the function every time you create, update, or delete an item.</p><p>The following output appears:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*9YYY_cQChO_QpTw43KdTDg.png" /></figure><h3>Export the Amazon DynamoDB table to Amazon S3</h3><ol><li>In Cloud Shell, create a variable for a bucket name that you use in several of the following sections. (BUCKET=$DEVSHELL_PROJECT_ID-dynamodb-spanner-export)</li><li>Create an Amazon S3 bucket to receive the DynamoDB export. (aws s3 mb s3://$BUCKET)</li><li>In the AWS Management Console, click <strong>Data Pipeline</strong>.</li><li>Click <strong>Create new pipeline</strong> to define the export job.</li><li>In the <strong>Name</strong> field, enter <strong>Export to Amazon S3</strong>.</li><li>For the <strong>Source</strong>, select the following: <strong>Build using a template -&gt; Export DynamoDB table to Amazon S3</strong></li><li>In the <strong>Parameters</strong> section, define the following:</li><li>In the <strong>Source DynamoDB table name</strong> field, enter Migration.</li><li>In the <strong>Output S3 folder</strong> field, click the <strong>Folder</strong> icon and select the [Your-Project-ID]-dynamodb-spanner-export Amazon S3 bucket that you just created where [YOUR-PROJECT-ID] represents your GCP project ID.</li><li>To consume all available read-capacity during the export, in the <strong>DynamoDB read throughput ratio</strong> field, enter <strong>1</strong>. In a production environment, you adjust this value so that it doesn&#39;t hinder live operations.</li><li>In the <strong>Region of your DynamoDB table</strong> field, enter the name of the region, for example, us-west-2.</li><li>To start the backup jobs immediately, in the <strong>Schedule</strong> section for <strong>Run</strong>, click <strong>On pipeline activation</strong>.</li><li>Under <strong>Pipeline Configuration</strong>, in the <strong>Logging</strong> field, enter Disabled. If you are following this guide to migrate a production table, leave this option enabled and pointed at a separate Amazon S3 bucket for logs to help you troubleshoot errors. Leave other default parameters.</li><li>To begin the backup process, click <strong>Activate</strong>.</li><li>If you are prompted to address validation warnings, click <strong>Activate</strong>. In a production situation, you set a maximum duration for the job and enable logging.</li><li>Click <strong>Refresh</strong> to update the status of the backup process. The job takes several minutes to create the resources and finish exporting. In a production environment, you can speed this process up by modifying the <strong>Data Pipeline</strong>jobs to use more EMR resources.</li><li>When the process finishes, look at the output bucket.</li></ol><ul><li>aws s3 ls — recursive s3://$BUCKET</li></ul><p>The export job is done when there is a file named _SUCCESS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*_OnePUAwUwJw9XQ409wMLQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab6b8828580d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/petabytz/database-migration-migrating-from-dynamodb-to-google-cloud-spanner-part-1-ab6b8828580d">Database Migration : Migrating from DynamoDB to Google Cloud Spanner (Part 1)</a> was originally published in <a href="https://medium.com/petabytz">Petabytz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VPC Network Peering on Google Cloud Platform(GCP)]]></title>
            <link>https://medium.com/petabytz/vpc-network-peering-on-google-cloud-platform-gcp-bb83a489b7a8?source=rss-3996b8ee8f4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb83a489b7a8</guid>
            <category><![CDATA[vpc]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[vpc-peering]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Harsh Muniwala]]></dc:creator>
            <pubDate>Thu, 27 Jun 2019 05:48:29 GMT</pubDate>
            <atom:updated>2019-06-27T06:43:18.091Z</atom:updated>
            <content:encoded><![CDATA[<h3>Overview</h3><p>VPC Network Peering enables you to peer VPC networks so that workloads in different VPC networks can communicate in private <a href="https://tools.ietf.org/html/rfc1918">RFC 1918</a> space. Traffic stays within Google’s network and doesn’t traverse the public internet.</p><p>VPC Network Peering is useful for:</p><ul><li>SaaS (<a href="https://wikipedia.org/wiki/Software_as_a_service">Software-as-a-Service</a>) ecosystems in GCP. You can make services available privately across different VPC networks within and across organizations.</li><li>Organizations with several network administrative domains can peer with each other.</li></ul><p>If you have multiple network administrative domains within your organization, VPC Network Peering allows you to make services available across VPC networks in private RFC 1918 space. If you offer services to other organizations, VPC Network Peering allows you to make those services available in private RFC 1918 space to those organizations. The ability to offer services across organizations is useful if you want to offer services to other enterprises, and it is useful within your own enterprise if you have several distinct <a href="https://cloud.google.com/resource-manager/docs/quickstart">organization nodes</a> due to your own structure or as a result of mergers or acquisitions.</p><p>VPC Network Peering gives you several advantages over using external IP addresses or VPNs to connect networks, including:</p><ul><li>Network Latency: Public IP networking suffers higher latency than private networking. All peering traffic stays within Google’s network.</li><li>Network Security: Service owners do not need to have their services exposed to the public Internet and deal with its associated risks.</li><li>Network Cost: GCP charges <a href="https://cloud.google.com/compute/pricing#internet_egress">egress bandwidth pricing</a> for networks using external IPs to communicate even if the traffic is within the same zone. If however, the networks are peered they can use internal IPs to communicate and save on those egress costs. <a href="https://cloud.google.com/compute/pricing#network">Regular network pricing</a> still applies to all traffic.</li></ul><p>For information about creating peering connections, see <a href="https://cloud.google.com/vpc/docs/using-vpc-peering">Using VPC Network Peering</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*cH4z9VxSY_JNowbjp9UkYQ.png" /></figure><h3>Key Properties</h3><p>Peered VPC networks exhibit the following key properties:</p><ul><li>VPC Network Peering works with <a href="https://cloud.google.com/compute/docs/">Compute Engine</a>, <a href="https://cloud.google.com/kubernetes-engine/docs/">GKE</a>, and <a href="https://cloud.google.com/appengine/docs/flexible/">App Engine flexible environment</a>.</li><li>Peered VPC networks remain administratively separate. Routes, firewalls, VPNs, and other traffic management tools are administered and applied separately in each of the VPC networks.</li><li>Each side of a peering association is set up independently. Peering will be active only when the configuration from both sides matches. Either side can choose to delete the peering association at any time.</li><li>Peering and the option to import and export custom routes can be configured for one VPC network even before the other VPC network is created. Although route exchange only occurs after both sides of the have been configured.</li><li>VPC peers always exchange all subnet routes. You can also exchange <a href="https://cloud.google.com/vpc/docs/routes#custom-routes">custom routes</a> (static and dynamic routes), depending on whether the peering configurations have been configured to import or export them. For more information, see <a href="https://cloud.google.com/vpc/docs/vpc-peering#importing-exporting-routes">Importing and exporting custom routes</a>.</li><li>Subnet and static routes are global. Dynamic routes can be <a href="https://cloud.google.com/vpc/docs/vpc-peering#regional">regional</a> or <a href="https://cloud.google.com/vpc/docs/vpc-peering#global">global</a>, depending on the VPC network’s dynamic routing mode.</li><li>A given VPC network can peer with multiple VPC networks, but there is a <a href="https://cloud.google.com/vpc/docs/quota#vpc-peering">limit</a>.</li><li><a href="https://cloud.google.com/iam/docs/">IAM permissions</a> for creating and deleting VPC Network Peering are included as part of the project owner, project editor, and network admin roles.</li><li>Peering traffic (traffic flowing between peered networks) has the same latency, throughput, and availability as private traffic in the same network.</li><li>Billing policy for peering traffic is the same as the <a href="https://cloud.google.com/compute/pricing#network">billing policy</a> for private traffic in same network.</li></ul><h3>VPC Network Peering setup</h3><p><strong>Create a custom network in projects</strong></p><p>In this setup you have been provisioned 2 projects, the first project as a <strong>testingproject</strong> and second as <strong>testingproject2</strong>.</p><p>For managing two projects start a new cloud shell by click <strong>+</strong> icon.</p><p>In the second cloud shell, set project ID by running the following, replacing &lt;PROJECT_ID2&gt; with GCP Project ID for the 2nd project:</p><blockquote>gcloud config set project &lt;PROJECT_ID2&gt;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*mcC35_OOF6BX-AVyOm34eg.png" /></figure><h4><strong>testingproject</strong>:</h4><p>Go back to first cloud shell and create a custom network:</p><blockquote>gcloud compute networks create network-a — subnet-mode custom</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*q5rNjWABg79q2xTQ-CXepw.png" /></figure><p>Create a subnet within this VPC and specify a region and IP range by running:</p><blockquote>gcloud compute networks subnets create network-a-central — network network-a \ — range 10.0.0.0/16 — region us-central1</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*fSw8l7Fx87kedbA_50Q30w.png" /></figure><p>Create a VM instance:</p><blockquote>gcloud compute instances create vm-a — zone us-central1-a — network network-a — subnet network-a-central</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*rWuKTVGfGJ37Mt03LsPR1A.png" /></figure><p>Run the following to enable SSH and icmp, because you&#39;ll need a secure shell to communicate with VMs during connectivity testing:</p><blockquote>gcloud compute firewall-rules create network-a-fw — network network-a — allow tcp:22,icmp</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*3-m55LGbgr2yJqwz5rFiAg.png" /></figure><p>Next you set up testingproject2 in the same way.</p><h4>testingproject2:</h4><p>Switch to the second cloud shell and create a custom network:</p><blockquote>gcloud compute networks create network-b — subnet-mode custom</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*s0jgXmkx8vcKVNZgmjUGtg.png" /></figure><p>Create a subnet within this VPC and specify a region and IP range by running:</p><blockquote>gcloud compute networks subnets create network-b-central — network network-b \ — range 10.8.0.0/16 — region us-central1</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*kY-HQqGwLuESDYW7rSz_rQ.png" /></figure><p>Create a VM instance:</p><blockquote>gcloud compute instances create vm-b — zone us-central1-a — network network-b — subnet network-b-central</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*DiLAEEzG5Jz5dpJpy605bw.png" /></figure><p>Run the following to enable SSH and icmp, because you&#39;ll need a secure shell to communicate with VMs during connectivity testing:</p><blockquote>gcloud compute firewall-rules create network-b-fw — network network-b — allow tcp:22,icmp</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*893VyQzHZo7VA19c75OcYg.png" /></figure><h3>Setting up a VPC Network Peering session</h3><p>Consider an organization which needs VPC Network Peering to be established between network-A in testingproject, and network-B in testingproject2. In order for VPC Network Peering to be established successfully, administrators of network-A and network-B must separately configure the peering association.</p><h3>Peer network-a with network-b:</h3><p>You will need to select the correct project in the console before you apply the settings. You’ll do that by clicking down arrow next to the GCP Project ID at the top of the screen, then selecting which project ID you need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*ajnAcH-KtYRNFQlUsvtNdg.png" /></figure><p><strong>testingproject</strong></p><p>Go to the VPC Network Peering in the Google Cloud Platform Console by navigating to the Networking section and clicking VPC Network &gt; VPC network peering in the left menu. Once you&#39;re there:</p><ol><li>Click <strong>Create connection</strong>.</li><li>Click <strong>Continue</strong>.</li><li>Type “peer-ab” as the <strong>Name</strong> for this side of the connection.</li><li>Under <strong>Your VPC network</strong>, select the network you want to peer (network-a).</li><li>Set the <strong>Peered VPC network</strong> radio buttons to <strong>In another project</strong>.</li><li>Paste in the <strong>Project ID</strong> of the second project.</li><li>Type in the <strong>VPC network name</strong> of the other network (network-b).</li><li>Click <strong>Create</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*AyiGQ4y1J0D9kGsiyIw33w.png" /></figure><p>At this point, the peering state remains INACTIVE because there is no matching configuration in network-b in testingproject2.</p><p>Example Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*9EWgRA0h7G9m5WrWBjriaw.png" /></figure><h3>Peer network-b with network-a</h3><p><strong>Note:</strong> Switch to the second project in the console.</p><p><strong>testingproject2</strong></p><ol><li>Click <strong>Create connection</strong>.</li><li>Click <strong>Continue</strong>.</li><li>Type “peer-ba” as the <strong>Name</strong> for this side of the connection.</li><li>Under <strong>Your VPC network</strong>, select the network you want to peer (network-b).</li><li>Set the <strong>Peering VPC network</strong> radio buttons to <strong>In another project</strong>, unless you wish to peer within the same project.</li><li>Specify the <strong>Project ID</strong> of the first project.</li><li>Specify <strong>VPC network name</strong> of the other network (network-a).</li><li>Click <strong>Create</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*wKkk1ltfPqyy5-wT1L1T0A.png" /></figure><p>Example Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*a4P31oatwipSD9ZaYZu-_Q.png" /></figure><p>VPC Network Peering becomes ACTIVE and routes are exchanged As soon as the peering moves to an ACTIVE state, traffic flows are set up:</p><ul><li>Between VM instances in the peered networks: Full mesh connectivity.</li><li>From VM instances in one network to Internal Load Balancing endpoints in the peered network.</li></ul><p>The routes to peered network CIDR prefixes are now visible across the VPC network peers. These routes are implicit routes generated for active peerings. They don’t have corresponding route resources. The following command lists routes for all VPC networks for testingproject.</p><blockquote>gcloud compute routes list — project &lt;FIRST_PROJECT_ID&gt;</blockquote><p>Example Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*-PNAvhvyMx6KSrN7IamfKA.png" /></figure><h3>Connectivity Test</h3><p><strong>testingproject</strong></p><p>Navigate to VM instances console: Click <strong>Navigation Menu</strong> &gt; <strong>Compute Engine</strong> &gt; <strong>VM instances</strong>.</p><p>Copy the <strong>INTERNAL_IP</strong> for vm-a.</p><p><strong>testingproject2</strong></p><p>Click <strong>Product &amp; services</strong> &gt; <strong>Compute</strong> &gt; <strong>Compute Engine</strong> &gt; <strong>VM instances</strong>.</p><p>SSH into vm-b instance.</p><p>In the SSH shell of vm-b, run the following command replacing &lt;INTERNAL_IP_OF_VM_A&gt; with the vm-a instance INTERNAL_IP:</p><blockquote>ping -c 5 &lt;INTERNAL_IP_OF_VM_A&gt;</blockquote><p>Example Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*ckLESUk7YRQb2XnYJJo4MA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb83a489b7a8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/petabytz/vpc-network-peering-on-google-cloud-platform-gcp-bb83a489b7a8">VPC Network Peering on Google Cloud Platform(GCP)</a> was originally published in <a href="https://medium.com/petabytz">Petabytz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VPC Creation on Google Cloud Platform(GCP)]]></title>
            <link>https://medium.com/petabytz/vpc-creation-on-google-cloud-platform-gcp-67fa397c1106?source=rss-3996b8ee8f4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/67fa397c1106</guid>
            <category><![CDATA[nat-gateway]]></category>
            <category><![CDATA[gateway]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[vpc]]></category>
            <category><![CDATA[subnet]]></category>
            <dc:creator><![CDATA[Harsh Muniwala]]></dc:creator>
            <pubDate>Wed, 26 Jun 2019 11:07:40 GMT</pubDate>
            <atom:updated>2019-06-26T11:07:40.994Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>What is VPC?</strong></h3><p>A virtual private cloud (VPC) is the legitimate division of a specialist co-op’s open cloud multi-inhabitant design to help private distributed computing. This model empowers a venture to accomplish the advantages of private cloud — for example, progressively granular authority over virtual systems and a separated domain for delicate outstanding tasks at hand — while as yet exploiting open cloud assets.</p><p>The terms private cloud and virtual private cloud are now and then utilized mistakenly as equivalent words. There is a particular distinction — in a customary, on-premises private cloud model, an undertaking’s inside IT division goes about as a specialist organization and the individual specialty units go about as occupants. With a VPC, an open cloud supplier goes about as the specialist organization and the cloud’s supporters are the inhabitants.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*m8JBpKt0WPWVQ7HAUMIi4g.png" /></figure><h3><strong>Subnets</strong></h3><p>Subnets are the following bit of the VPC. Why utilize distinctive subnets in your VPC and not just leave everything in one major glad (family) organize? There are various purposes behind this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*cbXhLlbTJ1heRqzMaXLXlQ.png" /></figure><p><strong>Segregation</strong></p><p>Not the majority of your outstanding tasks at hand have a place together in a solitary system. There are segments that are open confronting, and there are those that you would prefer not to open to the outside world, (for example, databases and mysteries).</p><p>In the cloud world today, you can’t generally expect that occasions will dependably be accessible and that their IP tends to will be the equivalent. Thus, it bodes well and is likewise significantly simpler to work a situation where certain gatherings (or families) of cases are alloted to explicit systems. This empowers you to keep up a legitimate dimension of security between the various levels without realizing the particular IP locations of a solitary occasion.</p><p><strong>Availability</strong></p><p>The following significant point that you should comprehend — a subnet can’t navigate in excess of a solitary accessibility zone.</p><p>Because of their topographical dispersity, a subnet can’t be characterized over more than one single accessibility zone. When conveying your outstanding burdens in the cloud, you should utilize the “free”’ and implicit excess highlights intrinsic in utilizing accessibility zones. This is the reason you would most likely need to partition your system into various subnets.</p><p><strong>Public vs. Private Subnets</strong></p><p>In your VPCs, you can characterize subnets that you need to be presented to the outside world (i.e., you can append open IP delivers to the examples). You can likewise characterize subnets that ought to never be legitimately gotten to from the outside world. Occasions on such a subnet could be your backend database or some mystery store that you would prefer not to be freely accessible. The contrast among open and private subnets is the course the traffic takes out to the web — the Internet Gateway or the NAT Gateway.</p><h3>Internet Gateway (IGW)</h3><p>Having examples running in cloud is extraordinary and fun, however on the off chance that you can’t get to them from the outside world or in the event that they can’t get to the outside world, reasonability will be extremely testing — if not totally unimaginable.</p><p>Your association with the outside world is the Internet Gateway.</p><p>You don’t need to characterize IP tends to when you set up your IGW. You don’t need to stress over repetition or scaling of this portal either — this is dealt with for you by cloud. You should simply make one.</p><p>The IGW is a straightforward segment. It doesn’t have its very own IP address and isn’t a part that you have to oversee.</p><p>It is critical to take note of that for a case to converse with the outside world, occasions must be situated on a subnet that has a course characterized to the IGW, and there must be an open IP address (Elastic IP) appended to that example. This is required to empower bi-directional correspondence between the outside world and the occasions.</p><h3>NAT Gateway (NGW)</h3><p>As referenced above, now and then you don’t need occurrences to be presented to the outside world and you don’t need them to have open IP addresses. Be that as it may, as a rule, these examples still need access to the outside world to get refreshes or to send outbound data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*a2qVSbEWz5riKddF6__Hiw.png" /></figure><p>In cloud, you have the choice of making a NAT Gateway to go about as the course to the outside world.</p><p>Like the IGW, you don’t need to design IP addresses. The NGW is very accessible and scales consequently — the majority of that is dealt with by Amazon. You should simply pick the subnet that approaches the outside world, and it will be arranged for you.</p><p>By utilizing a NGW, you can enable outbound access to the web and point of confinement the inbound access to those occasions, giving an extra layer of deliberation and insurance for your remaining tasks at hand.</p><p>Also, all traffic is steered through a solitary IP address. This facilitates the administration overhead on the off chance that you need recognize traffic leaving your VPC to a solitary location, for instance, with on-premises firewall standards or security bunches in other cloud suppliers.</p><h3>Route Tables</h3><p>The essential precept of systems administration is that everything inside your subnet remains inside your subnet — and in the event that you need to go outside of your subnet, you have to experience the default portal and from that point be steered to the following bounce to get to your goal arrange.</p><p>In cloud, traffic inside the VPC shouldn’t be steered. A switch (straightforward and made out of sight) deals with this for you and the passages in this switch are constrained by you through Route Tables.</p><p>When you need to get to an asset outside of your VPC, — you course traffic through your IGW (for your open cases) or through the NGW (for occurrences that are private).</p><p>The course tables are related with each of your subnets to enable the progression of traffic as indicated by the strategies and choices you have set up.</p><h3>Network Access Lists</h3><p>System Access Control Lists (NACLs) are accessible as a security include in your VPC. Your system head is no uncertainty acquainted with their utilization.</p><p>Security gatherings are in charge of controlling the traffic all through your cases. There will be situations where you need to implement an arrangement at a lower level, paying little respect to what exists in the security gathering.</p><p>How about we take the accompanying model: say that one of your clients conveys an occurrence in your VPC and neglected to set the security gathering to restrain the outbound traffic from the example. Therefore, data was spilled because of a pernicious endeavor.</p><p>With the utilization of a NACL, you could constrain the outbound traffic to explicit occasions or to specific goals just — guaranteeing that your framework is secure and protecting your licensed innovation from slip-ups and disasters. This is a component that operational security or system executives truly like since they don’t need to depend on the every one of the engineers utilizing the mists. With this component, they can keep up generally speaking control paying little heed to who is utilizing the cloud — or how mindful they are of security best practices.</p><h3>VPN Connectivity</h3><p>AWS,GCP knows that not all things can keep running in the open cloud, which is the place the alternative to associate your on premises framework with your VPC comes in. Every one of the alternatives are accessible through an API to enable you to rapidly and effectively set up an expansion of your outstanding tasks at hand that can live both inside your datacenter and in cloud.</p><p>Think about a VPC as your very own private bit of land on cloud. There are numerous parts engaged with your Virtual Private Cloud. You know about the system format and settings in your on-premises arrange areas and datacenters, and you see how all of them are associated. It is reasonable that with the transition to the cloud — understanding your VPC foundation, its capacities, and its confinements — it would be great practice to include these too.</p><p>Google Cloud Platform (GCP) Virtual Private Cloud (VPC) provides networking functionality to Compute Engine virtual machine (VM) instances, Kubernetes Engine containers and App Engine Flex. In other words, without a VPC network you cannot create VM instances, containers or App Engine applications. Therefore, each GCP project has a <strong>default</strong> network to get you started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*JW7V__ym3hrpEWN97WjRBQ.png" /></figure><p>You can think of a VPC network the same way you would think of a physical network, except that it is virtualized within GCP. A VPC network is a global resource which consists of a list of regional virtual subnetworks (subnets) in data centers, all connected by a global wide area network (WAN). VPC networks are logically isolated from each other in GCP.</p><h3>Create a VPC network and VM instances</h3><p><strong>Create an auto mode VPC network with Firewall rules</strong></p><p>Replicate the <strong>default</strong> network by creating an auto mode network.</p><ol><li>In the Console, navigate to <strong>Navigation menu</strong> &gt; <strong>VPC network</strong> &gt; <strong>VPC networks</strong>, and then click <strong>Create VPC network</strong>.</li><li>Set the <strong>Name</strong> to <strong>firstnetwork</strong>.</li><li>For <strong>Subnet creation mode</strong>, click <strong>Automatic</strong>. (Auto mode networks create subnets in each region automatically)</li><li>For <strong>Firewall rules</strong>, check all available rules. (These are the same standard firewall rules that the default network had)</li><li>Click <strong>Create</strong>, then wait for <strong>mynetwork</strong> to be created. (Notice that a subnet was created for each region)</li><li>Record the IP address range for the subnets in <strong>us-central1</strong> and <strong>europe-west1</strong>. You will refer to these in the next steps.</li></ol><p><strong>Create a VM instance in us-central1</strong></p><p>Create a VM instance in the us-central1 region. Selecting a region and zone determines the subnet and assigns the internal IP address from the subnet’s IP address range.</p><ol><li>In the Console, navigate to <strong>Navigation menu</strong> &gt; <strong>Compute Engine</strong> &gt; <strong>VM instances</strong>, and then click <strong>Create</strong>.</li><li>Set the following values, leaving all others at their defaults:</li></ol><blockquote>Name : mynet-us-vm</blockquote><blockquote>Region : us-central1</blockquote><blockquote>Zone : us-central1-c</blockquote><blockquote>Machine type : micro (1 shared vCPU)</blockquote><ol><li>Click <strong>Create</strong>, then wait for the instance to be created.</li><li>Verify that the <strong>Internal IP</strong> was assigned from the IP address range for the subnet in <strong>us-central1</strong> (10.128.0.0/20).</li></ol><p>The <strong>Internal IP</strong> should be 10.128.0.2 as 10.128.0.1 is reserved for the gateway and you have not configured any other instances in that subnet</p><p><strong>Create a VM instance in europe-west1</strong></p><p>Create a VM instance in the europe-west1 region.</p><ol><li>Click <strong>Create instance</strong>.</li><li>Set the following values, leaving all others at their defaults:</li></ol><blockquote>Name : mynet-eu-vm</blockquote><blockquote>Region : europe-west1</blockquote><blockquote>Zone : europe-west1-c</blockquote><blockquote>Machine type : micro (1 shared vCPU)</blockquote><ol><li>Click <strong>Create</strong>, then wait for the instance to be created.</li><li>Verify that the <strong>Internal IP</strong> was assigned from the IP address range for the subnet in <strong>europe-west1</strong> (10.132.0.0/20).</li></ol><p>The <strong>Internal IP</strong> should be 10.132.0.2 as 10.132.0.1 is reserved for the gateway and you have not configured any other instances in that subnet.</p><h3>Explore the connectivity for VM instances</h3><p>Investigate the network for the VM occurrences. In particular, SSH to your VM cases utilizing tcp:22 and ping both the inside and outside IP locations of your VM cases utilizing ICMP. At that point, investigate the impacts of the firewall administers on network by expelling the firewall governs one-by-one.</p><p><strong>Verify connectivity for the VM instances</strong></p><p>The firewall rules that you created with <strong>firstnetwork </strong>allow ingress SSH and ICMP traffic from within <strong>firstnetwork </strong>(internal IP) and outside of that network (external IP).</p><ol><li>In the Console, navigate to <strong>Navigation menu</strong> &gt; <strong>Compute Engine</strong> &gt; <strong>VM instances</strong>.</li><li>Note the external and internal IP addresses for <strong>mynet-eu-vm</strong>.</li><li>For <strong>mynet-us-vm</strong>, click <strong>SSH</strong> to launch a terminal and connect. You may have to click <strong>SSH</strong> twice.</li><li>You are able to SSH because of the <strong>allow-ssh</strong> firewall rule, which allows incoming traffic from anywhere (0.0.0.0/0) for <strong>tcp:22</strong>.</li><li>To test connectivity to <strong>mynet-eu-vm</strong>’s internal IP, run the following command using<strong>mynet-eu-vm</strong>’s internal IP: <strong>( ping -c 3 &lt;Enter mynet-eu-vm’s internal IP here&gt;)</strong></li><li>You are able to ping <strong>mynet-eu-vm</strong>’s internal IP because of the <strong>allow-internal</strong> firewall rule.</li><li>Repeat the same test, this time using <strong>mynet-eu-vm</strong>’s name: <strong>( ping -c 3 mynet-eu-vm)</strong></li><li>You are able to ping <strong>mynet-eu-vm</strong> by its name because VPC networks have an internal DNS service that allows you to address instances by their DNS names rather than their internal IP addresses. This is very useful as the internal IP address can change when deleting and re-creating an instance.</li><li>To test connectivity to <strong>mynet-eu-vm</strong>’s external IP, run the following command using <strong>mynet-eu-vm</strong>’s external IP: <strong>( ping -c 3 &lt;Enter mynet-eu-vm’s external IP here&gt;)</strong></li></ol><p><strong>Remove the allow-icmp firewall rules</strong></p><p>Remove the <strong>allow-icmp</strong> firewall rule and try to ping the internal and external IP address of <strong>mynet-eu-vm</strong>.</p><ol><li>In the Console, navigate to <strong>Navigation menu</strong> &gt; <strong>VPC network</strong> &gt; <strong>Firewall rules</strong>.</li><li>Check the <strong>firstnetwork-allow-icmp</strong> rule.</li><li>Click <strong>Delete</strong>, then click <strong>Delete</strong> to confirm the deletion.</li><li>Wait for the firewall rule to be deleted.</li><li>Return to the <strong>mynet-us-vm</strong> SSH terminal.</li><li>To test connectivity to <strong>mynet-eu-vm</strong>’s internal IP, run the following command using <strong>mynet-eu-vm</strong>’s internal IP: <strong>( ping -c 3 &lt;Enter mynet-eu-vm’s internal IP here&gt;)</strong></li><li>You are able to ping <strong>mynet-eu-vm</strong>’s internal IP because of the <strong>allow-internal</strong> firewall rule.</li><li>To test connectivity to <strong>mynet-eu-vm</strong>’s external IP, run the following command using <strong>mynet-eu-vm</strong>’s external IP: <strong>( ping -c 3 &lt;Enter mynet-eu-vm’s external IP here&gt;)</strong></li></ol><p><strong>Remove the allow-internal firewall rules</strong></p><p>Remove the <strong>allow-internal</strong> firewall rule and try to ping the internal IP address of <strong>mynet-eu-vm</strong>.</p><ol><li>In the Console, navigate to <strong>Navigation menu </strong>&gt; <strong>VPC network</strong> &gt; <strong>Firewall rules</strong>.</li><li>Check the <strong>firstnetwork-allow-internal</strong> rule and then click <strong>Delete</strong>. Click <strong>Delete</strong> to confirm the deletion.</li><li>Wait for the firewall rule to be deleted.</li><li>Return to the <strong>mynet-us-vm</strong> SSH terminal.</li><li>To test connectivity to <strong>mynet-eu-vm</strong>’s internal IP, run the following command using <strong>mynet-eu-vm</strong>’s internal IP: <strong>( ping -c 3 &lt;Enter mynet-eu-vm’s internal IP here&gt;)</strong></li><li>Close the SSH terminal: <strong>( exit )</strong></li></ol><h3>Remove the allow-ssh firewall rules</h3><p>Remove the <strong>allow-ssh</strong> firewall rule and try to SSH to <strong>mynet-us-vm</strong>.</p><ol><li>In the Console, navigate to <strong>Navigation menu</strong> &gt; <strong>VPC network</strong> &gt; <strong>Firewall rules</strong>.</li><li>Check the <strong>firstnetwork-allow-ssh</strong> rule and then click <strong>Delete</strong>. Click <strong>Delete</strong> to confirm the deletion.</li><li>Wait for the firewall rule to be deleted.</li><li>In the Console, navigate to <strong>Navigation menu</strong> &gt; <strong>Compute Engine</strong> &gt; <strong>VM instances</strong>.</li><li>For <strong>mynet-us-vm</strong>, click <strong>SSH</strong> to launch a terminal and connect.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67fa397c1106" width="1" height="1" alt=""><hr><p><a href="https://medium.com/petabytz/vpc-creation-on-google-cloud-platform-gcp-67fa397c1106">VPC Creation on Google Cloud Platform(GCP)</a> was originally published in <a href="https://medium.com/petabytz">Petabytz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>