1. Open the AWS Management Console: Go to the AWS Management Console and log in to your AWS account.
2. Choose RDS: From the list of AWS services, choose RDS (Relational Database Service).
3. Click “Create Database”: On the RDS dashboard, click the “Create database” button.
4. Choose a database engine: Select the engine you want to use for your RDS instance. Amazon RDS supports various database engines like MySQL, PostgreSQL, Oracle, SQL Server, MariaDB, etc.
5 Choose a use case: Select the use case that best fits your needs. This will determine the default settings for your RDS instance, such as the instance class, storage type, and allocated storage.
6 . Configure the instance: Configure the RDS instance by specifying its name, username, and password. You can also choose the instance type, storage type, allocated storage, and other settings based on your requirements.
7. Configure advanced settings: If needed, you can configure advanced settings such as backup retention, maintenance window, security groups, and VPC settings.
8. Launch the instance: After configuring all the settings, review your configuration and click “Create Database” to launch your RDS instance.
9. Please wait for the instance to launch: It may take several minutes for your RDS instance to launch. Once it is ready, you can connect to it using the endpoint provided in the AWS Management Console.
That’s it! You have now created an RDS instance in AWS. You can use this instance to host your database and connect to it from your applications.
IAM service policy
1. Open the IAM Management Console: Go to the AWS Management Console and log in to your AWS account. From the list of AWS services, choose “IAM” under “Security, Identity & Compliance”.
2. Create a new policy: In the left-hand navigation pane, click “Policies”, then click “Create policy”.
3. Select a policy template: On the Create Policy page, you can either create your custom policy or use a pre-defined policy template. To create a policy for RDS, you can select the “Amazon RDS” service from the list of available services.
4. Choose the actions: Next, you need to choose the actions that you want to allow or deny for this policy. For example, you might want to allow read-only access to RDS resources or grant permissions to create and modify RDS resources.
5. Select Permission ( Write )
( CreateDBSnapshot )
6. Choose the resources: Once you have selected the actions, specify the RDS resources to which this policy applies. You can choose to apply the policy to all resources or specify individual resources by ARN (Amazon Resource Name).
1 db Represents a DB instance that is an isolated database environment running in the cloud
Click to restrict access.
Click Theis Account
( 1 ) Resource Region
ap-south-1a
( 2 ) Resource db instance name
database-1
And Click ( Add ARNs )
2 Snapshot Represents a snapshot that is a backup of the storage volume of your DB instance
to restrict access.
Click Theis Account
( 1 ) Resource Region
ap-south-1a
( 2 ) Resource snapshot name
Highsky-Snapshot-name
And Click ( Add ARNs )
( 3 ) And Chick Any in this account
Next
7. Review and create the policy: After specifying the actions and resources, review the policy details and click “Create policy” to save the policy.
8. Attach the policy to a user or group: Once you have created the policy, you need to attach it to a user or group that needs access to RDS resources. You can do this by navigating to the user or group in the IAM console, clicking on the “Permissions” tab, and then attaching the policy to the user or group.
That’s it! You have now created an IAM service policy for RDS and attached it to a user or group. The user or group can now perform the allowed actions on the specified RDS resources.
IAM service role
1. Navigate to the IAM dashboard.
2. Click on “Roles” from the left-hand menu.
3. Click on the “Create role” button.
4. Choose the type of trusted entity for your role: an AWS service, another AWS account, or a web identity provider.
Use case Allow an AWS service like EC2, Lambda, or others to perform actions in this account.
Click The Lambda
5. Select the policies that define the permissions for your role. You can choose from existing policies or create a custom one.
6. Give your Role a name and description.
7. Review your role and click “Create role” to save it.
That’s it! You have now created an IAM service role in AWS. You can use this role to grant permissions to an AWS service or other entities that need to perform actions on your behalf.
Lambda function
1. Navigate to the Lambda dashboard.
2. Click on the “Create function” button.
3. Choose the type of function you want to create. You can create a function, blueprint, or serverless application repository from scratch.
4. Give your function a name and description.
5. Choose a runtime for your function, such as Python, Node.js, or Java.
( A runtime is a version of a programming language or framework that you can use to write Lambda functions. Lambda supports runtime versions for Node.js, Python, Ruby, Go, Java, C# (.NET Core), and PowerShell (.NET Core)
To use other languages in Lambda, you can create your own runtime.
Note that the console code editor supports only Node.js, Python, and Ruby. If you choose a compiled language, such as Java or C#, you edit and compile your code in your preferred SDE and upload a deployment package to the function. )
Taking by Python 3.1
6. Configure the function’s execution role, which determines the permissions that the function has to access AWS resources.
7. Write your function code or upload a ZIP file containing your code.
import boto3 def lambda_handler(event, context): rds_client = boto3.client('rds') instance_id = "database-1" snapshot_id="Highskysnapshot" try: response = rds_client.create_db_snapshot( DBInstanceIdentifier=instance_id, DBSnapshotIdentifier=snapshot_id ) print(f"Snapshot '{snapshot_id}' creation initiated.") return { "snapshot_id" : response['DBSnapshot']['DBSnapshotIdentifier'], "status" : "started creating" } except Exception as e: print(f"Error creating snapshot: {str(e)}") return None
8. Set up your function’s environment variables and any additional settings, such as memory and timeout settings. Click “Create function” to save your Lambda function.
After creating your Lambda function, you can test it manually or set up a trigger to invoke it automatically. You can also monitor your function’s performance and troubleshoot any errors using the AWS Lambda console.
CloudWatch
1. Navigate to the CloudWatch dashboard.
2. Click on “Events” from the left-hand menu.
3. Click on the “Create rule” button.
4. Choose the “Schedule” option under “Event Source”.
Click Continue To create rule
5. Configure the croon expression for when you want the RDS DB instance to start. For example, if you want it to start every day at 8 pm, you would use the expression 30 12 * * ? *
6. Choose the EC2 instance as the target for the event rule.
7. Configure the specific action that you want to perform on the RDS DB instance, which in this case is to start it.
8. Give your rule a name and description.
9. Click “Create rule” to save your CloudWatch event rule.
After creating your CloudWatch event rule, it will trigger at the scheduled times and start the specified EC2 instance. Be sure to test your rule to ensure it is working as expected.