How to Migrate Data from S3 to SQL Server?| 2 Easy Methods

on Amazon S3, Data Loading, Microsoft SQL Server, SQL Server • June 6th, 2022 • Write for Hevo

s3 to sql server - featured image

Amazon S3 is a popular storage solution from the stable of Amazon. It is a reliable and stable solution when it comes to storing enterprise data. Microsoft SQL Server is a leading RDBMS platform in the market. It is efficient in querying data and performing operations through an end-to-end process.

By migrating data from Amazon S3 to SQL Server, a proper ETL process can be performed to gain the most from the data. It also enables a proper insight generation from the data.

This article details two comprehensive methods that can be used to migrate data from Amazon S3 to SQL Server.

Table of Contents

What is Amazon S3?

S3 to SQL Server: s3 logo
Image Source: miro.medium.com

Amazon S3 is a popular storage service from the house of Amazon Web Services. It is object-based storage that enables the users to store large amounts of data present in various formats like application files, blogs, codes, and many more with ease. S# stands for Simple Storage Service.

Amazon S3 is believed to be 99.9999% durable and ensures the high availability of data. It is a robust platform with the availability of various integrations, that enable it to be integrated with numerous sources to perform ETL. It also supports the integration of various programming languages like Python, Java, Scala, and more. Amazon S3 further has a provision for command-line interfacing that allows performing operations like adding, modifying, viewing, and manipulating data present in S3. 

Amazon S3 provides industry-leading scalability, security, accessibility, and performance. The data is stored in form of Buckets. It supports a single object size of 5 TB. It also has Data Management features built-in so that it is easy to handle data. 

Key Features of Amazon S3

Amazon S3 is a fully managed storage solution. It provides various features. A few of them are mentioned below:

  • Ease of Use: Amazon S3 provides an easy-to-use interface with simple operating requirements, that enable better interaction with data present in AWS S3.
  • Secure: S3, belonging to the stable of AWS, meets all the security policies and regulations. It also has a provision for SSL data transport, which encrypts automatically when data is loaded. In addition, the availability of IAM policies allows for better access control.  
  • Scalable: Amazon S3 is highly scalable and you don’t need to worry about any storage.
  • High Performance: Amazon S3 is a part of Amazon’s CloudFront, which provides it with low latency and faster data transfers.  
  • AWS Integrations: Amazon S3 has provisions for several integrations and API support. It can also be easily connected to applications from Amazon’s ecosystem like Amazon Kinesis, Amazon RDS, and many more.

To explore Amazon S3, visit the official website here.

What is Microsoft SQL Server?

S3 to SQL Server: sql server
Image Source: motc.gov.qa

SQL Server is a popular Relational Database Management System. It was developed by Microsoft and launched on April 24, 1989. It was written in programming languages C and C++. It follows a relational model architecture that was invented by E.F.Codd. 

The Relational Model stores the data in a structured format and generates relations between each table. The data is organized in the form of rows and columns where the column represents an attribute or feature and the row represents the value or record.

SQL Server comes in many versions, each with a slightly different feature set and query limits. The versions are Express, Enterprise, Standard, Web, and Developer

In case you want to install SQL Server, you may click here and download a version as per your system requirements.

Key Features of SQL Server

S3 to SQL Server: sql server architecture
Image Source: www.researchgate.net
  • Cloud Database Support: Microsoft SQL Server is readily integrable with Cloud applications like Azure and Microsoft SQL. all the versions have in-built security and data management tools. This cloud support enables the data to be readily available and allows for better management in case of failures.
  • Ease of Management: Microsoft SQL Server uses the Kubernetes for its server management and deployment. It can be easily combined with Windows and Linux operating systems. 
  • High-Security: SQL Server meets all the Data Security regulations. It also has a high level of encryption to data that is added. Tables can be protected using passwords and also has access control options. 
  • End-to-End Business Data Solutions: SQL Server offers an end-to-end solution for business data. It offers tools for Data Administrator, ETL solutions, Data Mining, and many others.

Explore These Methods to Load Data From S3 to SQL Server

Amazon S3 is known to provide a reliable and robust solution for storing data in different formats. It is backed by Amazon’s feature suite which lends it security and performance. SQL Server is a more traditional solution that can provide valuable insights. By Loading data from S3 to SQL Server, it is possible to highlight and find information critical to business decisions. The Data Loading from S3 to SQL Server can be done using two methods.

Method 1: Migrate Data from S3 to SQL Server via AWS Services

This method would be time-consuming and somewhat tedious to Load Data from S3 to SQL Server. You have to be very careful of the order while executing and even a small mistake requires the whole process to be run again.

Method 2: Automated S3 to SQL Server Migration using Hevo Data

Hevo Data, an Automated Data Pipeline, provides you with a hassle-free solution to load data from S3 to SQL Server within minutes with an easy-to-use no-code interface. Hevo is fully managed and completely automates the process of not only loading data but also enriching the data and transforming it into an analysis-ready form without having to write a single line of code.

GET STARTED WITH HEVO FOR FREE

Both the methods are explained below.

Methods to Migrate Data from Amazon S3 to SQL Server

Data can be migrated from Amazon S3 to SQL Server via two different methods. 

Method 1: Migrate Data from S3 to SQL Server via AWS Services

Step 1: Create an AWS S3 Bucket

  • Log in to your Amazon Console. 
  • Click on Find Services and search for S3.
S3 to SQL Server: aws management console
Image Source: miro.medium.com
  • Now, click on the Create Bucket button.
  • Enter the bucket name and select the region.
S3 to SQL Server: create bucket
Image Source:miro.medium.com
S3 to SQL Server: name and region of bucket
Image Source: miro.medium.com
  • Click on the Create Button. 
  • Search for the Bucket, and check for access. It should not be public.
 S3 to SQL Server: access privilege of bucket
Image Source: miro.medium.com

Step 2: Add Sample Data as CSV Files in S3 Buckets

  • Create a file “employee_Hevo.csv.”
  • Add the following components:
Employee_Id,Employee_First,Employee_Last,Employee_Title
1,Jane,Doe,Software Developer
2,Vikas,Sharma,Marketing
3,Rajesh,Kumar,Project Manager
4,Akshay,Ram,Customer Support
  • In the S3 console, select the bucket name you just created. 
  • Click on the upload option and follow the onscreen instructions.
S3 to SQL Server: upload CSV into bucket
Image Source: miro.medium.com

Step 3: Configure SQL Server Database Tables & Objects

  • Open SQL Server Management Studio and run the script below or create a similar table.
CREATE TABLE [dbo].[Employees](
[Employee_Id] [int] IDENTITY(1,1) NOT NULL,
[Employee_First] [varchar](25) NULL,
[Employee_Last] [varchar](25) NULL,
[Employee_Title] [varchar](50) NULL,
CONSTRAINT [PK_Employees] PRIMARY KEY CLUSTERED
(
[Employee_Id] ASC
)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

Step 4: Create the IAM Policy for Accessing S3

  • Before the data is migrated from S3 to SQL Server, you need to set up IAM policies so that the bucket you created earlier is accessible.
  • Click on AWS search and search IAM.
S3 to SQL Server: IAM role
Image Source: miro.medium.com
  • In the policies section, click on create policy
 S3 to SQL Server: new policy
Image Source: miro.medium.com
  • Click on the choose a service button to search for S3.
S3 to SQL Server: create new policy
Image Source: miro.medium.com
  • Complete and fill all the access levels and parameters.
S3 to SQL Server: selecting the required parameters for policy
Image Source: miro.medium.com
  • In the resources tab, select the bucket name and click on the Add ARN button. Enter the bucket name.
S3 to SQL Server: adding arn to bucket
Image Source: miro.medium.com
  • Add the CSV file by specifying the ARN.
S3 to SQL Server: adding object to arn
Image Source: miro.medium.com
  • Go to the review policy section and click on Create Policy.
S3 to SQL Server: reviewing policy
Image Source: miro.medium.com
  • Create the IAM role to use the policy. Open the AWS Console, and go to IAM. Select the Roles tab. 
  • Click on create the role. Follow the below mentioned order:
    • AWS service (at the top.)
    • RDS (in the middle list, “select a service to view use cases”.)
    • RDS — Add Role to Database (towards the bottom in the “Select your use case” section.)
  • Click on the next: permission button. Attach the permission policies by entering the name of the policy.
  • Follow the instructions on the screen. Click on review role, enter the values and then click on create the role. 
S3 to SQL Server: creating role
Image Source: miro.medium.com

Step 5: Push Data from S3 to SQL Server Instance

  • Open the AWS Console and click on RDS.
  • Choose the SQL server instance name to load data from S3 to SQL Server.
  • In the security and connectivity tab, select the IAM roles and click on Add IAM Roles.
  • Choose S3_integration in the feature section.
  • Click on Add Role button.
S3 to SQL Server: managing IAM roles
Image Source: miro.medium.com

Limitations of a Manual Approach

  • The manual method for loading data from S3 to SQL Server requires a lot more technical expertise.
  • There are many steps involved in the manual method for S3 to SQL Server and in case a step gets mixed up, all the steps need to run from the start. 
  • Creating IAM roles and access control is difficult.

Method 2: Automated S3 to SQL Server Migration using Hevo Data

Hevo Banner | S3 to SQL Server | Hevo Data
Image Source

All these limitations can be overcome using an Automated Data Pipeline like Hevo. Hevo Data is a No-code Data Pipeline solution that can help you seamlessly replicate data in real-time from 100+ data sources (Including 40+ free sources) like Amazon S3 your desired destination such MS SQL Server, Data Warehouses, or BI tools in a completely hassle-free & automated manner. 

Sign up here for a 14-Day Free Trial!

With Hevo, S3 to SQL Server Migration becomes a simple two-step process:

Step 1: Configure S3 Source in Hevo

A) Obtain your Access Key ID and Secret Access Key

You require a secret key to set S3 as a source. Perform the following steps to obtain your AWS Access Key ID and Secret Access Key:

  • Log in to the AWS Console.
  • In the drop-down menu in the profile section, click on security credentials. 
S3 to SQL Server: Security Credentials on console
Image Source: res.cloudinary.com
  • On the Security Credential page, click on Access Keys.
  • Click Create New Access Key.
  • Click Show Access Key to display the generated Access Key ID and Secret Access Key. Copy the details or download the key file for later use.
B) Configuring Amazon S3 as a Source

To configure Amazon S3 as a Source in Hevo:

  • In the Asset palette, click on PIPELINES. 
  • In the pipeline List view, click on the Create button. 
  • Select S3 in the Select Source Type.
  • In the Configure your S3 Source page, specify the following:
 S3 to SQL Server: S3 settings
Image Source: res.cloudinary.com
  • Pipeline Name: A unique name for the Pipeline.
  • Access Key ID: The AWS access key ID that you retrieved in Step 1 above.
  • Secret Access Key: The AWS Secret Access Key for the Access Key ID that you retrieved in Step 1 above.
  • Bucket: The name of the bucket from which you want to ingest data.
  • Bucket Region: Choose the AWS region where the bucket is located.
  • Path Prefix: The prefix of the path for the directory which contains the data. By default, the files are listed from the root of the directory.
  • File Format: The format of the data file in the Source. Hevo currently supports AVRO, CSV, JSON, and XML formats. Contact Hevo Support if your Source data is in another format.

For more information, refer the Hevo’s documentation for AWS S3.

  1. Click TEST & CONTINUE to proceed with setting up the Destination.

Step 2: Configure SQL Server Destination in Hevo

A) Add Destination

Do one of the following:

  • After the source is configured, click on Add Destination. 
  • In the Asset Palette, click on Destinations.
  • Click on the Create button on the Destination List View. 
B) Select Destination Type
  • On the Add Destination page, select MS SQL Server.
C) Configure MS SQL Server Connection Settings

Specify the following settings in the Configure your MS SQL Server Destination page:

S3 to SQL Server: MS SQL Server Destination settings
Image Source: lh3.googleusercontent.com
  • Destination Name: A unique name for your Destination.
  • Database Host: The SQL Server host’s IP address or DNS.
  • Database Port: The port on which your SQL Server listens for connections. Default value: 1433
  • Database User: A user with a non-administrative role in the SQL Server database.
  • Database Password: The password for the user.
  • Database Name: The name of the Destination database to which the data is loaded.
  • Database Schema: The name of the Destination database schema (Default value: dbo)
  • Additional Settings:
    • Connect through SSH: Enable this option to connect to Hevo using an SSH tunnel, instead of directly connecting your MS SQL Server database host to Hevo. This provides an additional level of security to your database by not exposing your MS SQL Server setup to the public. Read Connecting Through SSH.
    • Sanitize Table/Column Names: Enable this option to remove all non-alphanumeric characters and spaces in a table or column name, and replace them with an underscore (_). Read Name Sanitization.
D) Test Connection
  • After filling in the details, click on TEST CONNECTION to test connectivity to the Destination SQL Server Database.

Conclusion

Amazon S3 is one of the best data storage solutions that support various different formats. It stores the data efficiently but getting insight from it is slightly difficult. Migrating data into a more traditional RDBMS allows us to gain insights better. This article provides two different methods that can be used to migrate data from S3 to SQL Server.

There are various trusted sources that companies use as it provides many benefits, but, transferring data from it into a data warehouse is a hectic task. The Automated data pipeline helps in solving this issue and this is where Hevo comes into the picture. Hevo Data is a No-code Data Pipeline and has awesome 100+ pre-built Integrations such as AWS S3 & SQL Server that you can choose from.

visit our website to explore hevo

Hevo can help you Integrate your data from 100+ data sources such as AWS S3 and load them into a destination like SQL Server to Analyze real-time data. It will make your life easier and data migration hassle-free. It is user-friendly, reliable, and secure.

SIGN UP for a 14-day free trial and see the difference!

Share your experience of learning about AWS S3 to SQL Server in the comments section below.

No-code Data Pipeline For SQL Server