<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: sai parisheth</title>
    <description>The latest articles on DEV Community by sai parisheth (@sai_parisheth).</description>
    <link>https://dev.to/sai_parisheth</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1530279%2F79ef049d-6bed-4f14-8f7e-7ae91b06fb94.png</url>
      <title>DEV Community: sai parisheth</title>
      <link>https://dev.to/sai_parisheth</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sai_parisheth"/>
    <language>en</language>
    <item>
      <title>Building Dynamic Subdomain Routing for User Signups in Your SaaS Product</title>
      <dc:creator>sai parisheth</dc:creator>
      <pubDate>Sat, 14 Sep 2024 04:42:38 +0000</pubDate>
      <link>https://dev.to/sai_parisheth/building-dynamic-subdomain-routing-for-user-signups-in-your-saas-product-3i3f</link>
      <guid>https://dev.to/sai_parisheth/building-dynamic-subdomain-routing-for-user-signups-in-your-saas-product-3i3f</guid>
      <description>&lt;p&gt;Recently, I had the opportunity to help a friend set up dynamic subdomain routing for his SaaS product. He already had a functioning frontend in Angular, a backend built on Node.js, and a MongoDB database. However, his goal was to enhance the user experience by assigning a unique subdomain to each user upon signup.&lt;/p&gt;

&lt;p&gt;The existing resources were:&lt;/p&gt;

&lt;p&gt;A domain registered with GoDaddy.&lt;br&gt;
An AWS account with access to key services such as Route 53, CloudFront, EC2, and S3.&lt;br&gt;
The Plan&lt;br&gt;
The primary requirement was to configure dynamic subdomain routing, where each new user would receive their own subdomain, e.g., user1.example.com. This involved configuring AWS services, primarily Route 53 for DNS management, CloudFront for content distribution, and S3 for hosting the static Angular frontend.&lt;/p&gt;

&lt;p&gt;Step 1: Setting up the Frontend&lt;br&gt;
The Angular frontend was hosted on an S3 bucket, which was configured as a static website. We then used CloudFront as the content delivery network (CDN) to distribute the static assets globally.&lt;/p&gt;

&lt;p&gt;To handle dynamic subdomains, we added a wildcard domain (*.example.com) to the CloudFront distribution. This wildcard ensures that any subdomain requests (such as user1.example.com, user2.example.com, etc.) would point to the same CloudFront distribution, allowing us to serve the same frontend while handling the unique subdomains at the DNS level.&lt;/p&gt;

&lt;p&gt;Step 2: Configuring Route 53 for Subdomain Traffic&lt;br&gt;
Next, we set up Route 53 to manage DNS records for the domain. The key here was the ability to dynamically create A or CNAME records for each user’s subdomain. For example, when a new user signs up, we programmatically added a new record such as user1.example.com pointing to the CloudFront distribution.&lt;/p&gt;

&lt;p&gt;Each new subdomain required a corresponding DNS entry in Route 53, which would route the traffic to CloudFront. The wildcard configuration in CloudFront allowed any subdomain created in Route 53 to automatically route traffic to the frontend.&lt;/p&gt;

&lt;p&gt;Step 3: Automating DNS Record Creation on Signup&lt;br&gt;
The real challenge came with automating the creation of subdomains in Route 53 for each user. To achieve this, we integrated AWS SDK into the backend (Node.js) to programmatically create DNS records. Here’s how we approached it:&lt;/p&gt;

&lt;p&gt;AWS Credentials: We generated an Access Key ID and Secret Access Key from AWS IAM with appropriate permissions to modify Route 53 records. These keys were securely stored in our backend system.&lt;br&gt;
Automating Route 53 Updates: On every user signup, the backend would generate a unique subdomain for the user, e.g., user1.example.com. Using the AWS SDK, the backend automatically added a new DNS record in Route 53, pointing the subdomain to the CloudFront distribution. This automation eliminated manual DNS configuration, making the process scalable.&lt;br&gt;
Backend Logic: The backend code handled the generation of subdomain names and ensured that they were unique. It then communicated with AWS to create the necessary DNS records in Route 53, using the secret keys we had configured.&lt;br&gt;
Additional Insights&lt;br&gt;
Scalability: This architecture ensures scalability. With the dynamic subdomain routing, the system could handle thousands of users, each with their own subdomain, without the need for manual DNS management. The integration of Route 53 and CloudFront provides a seamless flow of traffic and ensures optimal performance for users across different geographical regions.&lt;br&gt;
Security: Using IAM roles with the least privilege principle ensured that the backend only had access to Route 53 for creating DNS records, limiting potential security risks.&lt;br&gt;
Performance Optimization: The use of CloudFront with a globally distributed edge network significantly reduced latency and improved the overall performance of the application, providing a fast experience for users regardless of their location.&lt;br&gt;
This project was a valuable learning experience, particularly in how to leverage AWS services like Route 53 and CloudFront for dynamic DNS management. It not only streamlined the user signup process but also ensured scalability and performance for the SaaS product as it continues to grow.&lt;/p&gt;

</description>
      <category>dynamicsubdomainrouting</category>
      <category>subdomain</category>
      <category>aws</category>
      <category>saas</category>
    </item>
    <item>
      <title>Best RPA tips and tricks</title>
      <dc:creator>sai parisheth</dc:creator>
      <pubDate>Sat, 01 Jun 2024 07:14:31 +0000</pubDate>
      <link>https://dev.to/sai_parisheth/best-rpa-tips-and-tricks-4e85</link>
      <guid>https://dev.to/sai_parisheth/best-rpa-tips-and-tricks-4e85</guid>
      <description>&lt;p&gt;I’ve had the pleasure of working on Python RPA scripts, focusing on automation and data extraction from both modern and legacy web applications.&lt;/p&gt;

&lt;p&gt;Two key takeaways were that automating and extracting data from modern web applications is relatively straightforward, but working with older, more complex applications presented some unique challenges.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Driver.cookies() this function helps to take the current cookies of the tab and we can reuse the same cookies to hit the api endpoint (which contains the data we need). By this we can reduce the automation process and scrap the data faster and effectively.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def get_hash_value(customer_id,document_id):
    cookies = driver.get_cookies()
    cookie_string=""
    #this loop sets the necessary cookies
    for cookie in cookies:
        cookie_string+=cookie['name']+'='+cookie['value']+'; '
    headers = {
        'authority': 'www.example.com',
        'accept': 'application/json, text/javascript, */*; q=0.01',
        'accept-language': 'en-US,en;q=0.9',
        'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
        'cookie': cookie_string,
        'origin': 'https://qa.devfovea.com',
        'referer': 'https://www.example.com/secret',
        'sec-ch-ua': '"Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"',
        'sec-ch-ua-mobile': '?0',
        'sec-ch-ua-platform': '"Windows"',
        'sec-fetch-dest': 'empty',
        'sec-fetch-mode': 'cors',
        'sec-fetch-site': 'same-origin',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
        'x-requested-with': 'XMLHttpRequest',
    }
    data = {
    'querystring': f'CustId={customer_id}&amp;amp;DocumentId={document_id}',
    }
    url = 'https://www.example.com/GetHashedValue'
    response = requests.post(url, headers=headers, data=data)
    if response.status_code == 200:
        return response.json()
    else:
        print(f"Request failed with status code {response.status_code}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.To Extract specific datas from a table, You can find the particular table element. And iterate the the table through values&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from selenium import webdriver
from selenium.webdriver.common.by import By

# Initialize the WebDriver
driver = webdriver.Chrome()  # Ensure chromedriver is in your PATH

# Navigate to the webpage
url = 'https://example.com/page-with-table'  # Replace with the target URL
driver.get(url)

# Locate the table by its ID
table = driver.find_element(By.ID, 'example-table')  # Replace with the actual ID of the table

# Extract table rows
rows = table.find_elements(By.TAG_NAME, 'tr')

# Initialize a list to store table data
table_data = []

# Loop through each row and extract cell data
for row in rows:
    # Extract cell data from each row
    cells = row.find_elements(By.TAG_NAME, 'td')
    cell_data = [cell.text for cell in cells]
    table_data.append(cell_data)

# Print the extracted data
for row in table_data:
    print(row)

# Close the WebDriver
driver.quit()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.The last one but useful one. Whenever I get stuck in writing scripts for an old and shabby websites I use selenium webdriver extension and record the actions and clicks and export to python script. You can find the selenium webdriver extension in chrome webstore.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0lf5uspssj3usacczhep.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0lf5uspssj3usacczhep.png" alt="Image description" width="800" height="316"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rpa</category>
      <category>python</category>
      <category>selenium</category>
      <category>api</category>
    </item>
  </channel>
</rss>
