Posts

Showing posts from October, 2021

How to share a custom AMI to other accounts

Image
Hi everyone 🙂, I am Manshu Sharma and today we are going to discuss an interesting topic that will help us to share custom private AMI in all accounts & regions. In this post first, create a custom encrypted AMI from the public AMI, and then share the custom AMI with encrypted EBS snapshots across accounts and regions. This approach allows you to launch Amazon EC2 instances globally from multiple accounts by using the same base-encrypted AMI. Requirments We need two AWS accounts i.e SourceAccount & DestinationAccount Have a basic knowledge of AWS services SourceAccount:- In which you build a custom AMI and encrypt the associated EBS snapshots. DestinationAccount:- In which you launch instances using the shared custom AMI with encrypted snapshots. Note :- While writing this blog post I am considering two imaginary AWS account ids  111111111111   with region us-east-1 for  SourceAccount & 999999999999   with us-east-1 for DestinationAccount so be sure yo...

Min Steps To 1

Given a positive integer 'n', find and return the minimum number of steps that 'n' has to take to get reduced to 1. You can perform any one of the following 3 steps: 1.) Subtract 1 from it. (n = n - ­1) , 2.) If n is divisible by 2, divide by 2.( if n % 2 == 0, then n = n / 2 ) , 3.) If n is divisible by 3, divide by 3. (if n % 3 == 0, then n = n / 3 ). Input format : The first and the only line of input contains an integer value, 'n'. Output format : Print the minimum number of steps. Constraints : 1 <= n <= 10 ^ 6 Time Limit: 1 sec Sample Input 1 : 4 Sample Output 1 : 2 Explanation of Sample Output 1 : For n = 4 Step 1 : n = 4 / 2 = 2 Step 2 : n = 2 / 2 = 1 Sample Input 2 : 7 Sample Output 2 : 3 Explanation of Sample Output 2 : For n = 7 Step 1 : n = 7 ­- 1 = 6 Step 2 : n = 6 / 3 = 2 Step 3 : n = 2 / 2 = 1

Popular posts from this blog

MySQL Multi Source Master Slave Replication using GTID

Access and modify all the resources of our Wiki.js using WikiJS API

How to setup an Nginx reverse proxy with a SSL certificate in XWIKI