Search code examples
sqlsql-serveramazon-web-servicescreate-table

AWS MS SQL create table


I have created an AWS MS SQL database following this guide

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_GettingStarted.CreatingConnecting.SQLServer.html#CHAP_GettingStarted.Connecting.SQLServer

I can connect to it and use the command

Select @@VERSION 

However, when I try to create a table I get the error

Msg 262, Level 14, State 1, Line 1 CREATE TABLE permission denied in database 'master'.

And the command I tried was

CREATE TABLE [RawInput] (
  [DateTime] datetime,
  [Text] text,
  PRIMARY KEY ([DateTime])
);

Solution

  • I have now fixed it.

    The tutorial I followed did not show all the necessary steps. I have below compiled a list of all the steps I went through:

    1) Download and install the AWS Toolkit for Visual Studio. https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/setup.html#install

    2) To login to AWS with Visual Studio, you need to create AWS Credentials Go to the AWS console panel and go under Services/IAM/Users - And add new user

    3) The newly created credentials are to be provided to Visual Studio. https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/credentials.html

    4) The database can now be created https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/rds-launch-instance-sql.html

    5) The database is now ready and the command can be executed, to create the tables. Here it is important that you specify the database you would like to write to with the USE [INSER_NAME_OF_DATABSE] keyword. Else it will try to write to Master.