How can I migrate ECS Instance across Dedicated Host - dedicated-server

I have an Alibaba Cloud ECS and want to migrate across my Dedicated Host (DDH).
How can I do the same and Is there any limitation on the ECS.
I appreciate any assistance with this.

I think this documentation clarify how to do it enter link description here
Log on to the ECS console.
In the left-side navigation pane, click Instances.
Select a region.
Optional. In the upper-right corner of the instance list, click the Set Display Items icon, and on the dialog box, click Dedicated Host,and then click OK.
You can view the Dedicated Host column in the table, which helps you locate the DDH that an ECS instance is hosted on.
Find an ECS instance, and in the Actions column, select More >Instance Status > Stop to stop the instance.
When the instance is in the Stopped status, in the Actions column, select More > Instance Settings > Modify DDH Deployment.
On the dialog box, select a DDH and click OK.

Procedure to migrate ECS Instance across Dedicated Host is as follows:
Log on to the ECS console.
Navigate to Instances List
Select the region
Click Settings Icon and enable dedicated host column view, Locate DDH where the ECS is Hosted On
Stop the instance
Click Actions--> More --> Instance Settings --> Modify DDH Deployment, dialog box will appear, select the DDH and then click Ok.
Note: Refresh the instance list until the Dedicated Host information is updated. The instance starts automatically.

Related

Automate retrieving password from Ec2 windows instance that was launched from custom AMI

When the instance is launched from the custom AMI I could not retrieve password for the launched instance. This issue and resolution is discussed here and it worked.
These are the manual steps I performed:
Open the Amazon EC2 console, and then connect to the original Windows EC2 instance using Remote Desktop Protocol (RDP).
From the Windows Start menu, do the following:
For Windows Server 2008 through Windows Server 2012 R2, open EC2ConfigService Settings, and then choose the Image tab.
For Windows Server 2016 or later, open EC2 Launch Settings.
For Administrator Password, choose Random.
Select Shutdown without Sysprep *.
Select Yes.
Open the Amazon EC2 console, and then select Instances.
Wait until the instance state changes to Stopped, and then choose your instance.
Select Actions, Image, Create image.
For Image name, enter a name.
(Optional) For Image description, enter a description.
Choose Create image.
I wanted to know if steps from 1 to 5 can be automated?
The source instance has the following scripts, and wondering if any of these script will do the trick, if yes, then what parameter I need to pass
"C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\SendWindowsIsReady.ps1 -Schedule",
"C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 -Schedule",
"C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\SysprepInstance.ps1 -NoShutdown"

Can't create a new working MWAA environment

In the past two days, we can't create a new working MWAA environment. We started with Terraform - after apply, the environment is indicated as "Available" in the console, but when I click on the "Open UI" link, the UI never comes up. Then we manually created a couple environments, but with the same outcome. For us, MWAA as a service is practically down.
Here is what we are seeing when we click on "Open Airflow UI":
This page isn’t working
zxxcvbnm-6666-4516-935b-bb9701f525e5-vpce.c20.us-west-2.airflow.amazonaws.com
didn’t send any data.
ERR_EMPTY_RESPONSE
Any insight/tip is appreciated!
So - it turns out some subnet combinations work, some don't. I believe it's a bug in MWAA.
Another possibility that I just ran into when trying to create an MWAA environment is that the security group wasn't allowing HTTPS connections.
To adjust that:
Click into your environment to view the configuration and scroll down to the "Networking" section.
Click into "VPC security group(s)"
Click on the "Inbound Rules" tab
Click on the "Edit Inbound Rules" button
Click on the "Add Rule" button
In the "Type" dropdown, select "HTTPS"
Under the "Source" dropdown you will probably want "Custom" along with your desired CIDR block.
Click on "Save Rules", and your new rules should be applied.

How to add aws ec2 at rundeck?

I added a new aws-ec2 source at rundeck and also inserted a rundeck-ec2 plugin at the libext folder. Everything is working but this new aws-ec2 node is not showing show at nodes.
Any idea what is happening and how to solve it?
I leave the steps to use the ec2-plugin with Rundeck, in this guide I used Amazon Linux 2 as EC2 instance.
Download the plugin from here, and put the .jar file on Rundeck libext directory.
Check that the plugin is ready, go to the Gear icon (up to right) > Plugins > Installed Plugins, if you use the textbox to find "ec2" you can see that the plugin is well installed on your Rundeck instance.
Now it's time to add your nodes, go to Project Settings (Rundeck sidebar) > Edit Nodes and click on "Add a new Node Source +" button. Then select "AWS EC2 Resources" from list.
So, you need to pass some parameters to connect to your EC2 nodes. Focus on the "Access Key", "Secret Key" and "Endpoint" textboxes.
You can get the first and second one going to your AWS profile link (Up to right on AWS) > "My Security Credentials" > and click on "Create access key" button, that generates the Access Key ID and Secret Key (also, you can use some Access Key ID/Secret access key created before).
The third one ("Endpoint"), it's an HTTPS URL with your instance Endpoint, for example, if your EC2 nodes are in US East (N. Virginia) Zone, you need to put https://ec2.us-east-2.amazonaws.com, you can see all endpoint codes here.
If you click on "Nodes" (Rundeck sidebar) you can see your EC2 nodes listed.
Now, you need to access them, for that you have two methods.
5a. Using the AWS .pem file: Click on the Gear Icon (up to right) > Key Storage and add a new Private key with the .pem file content, give it a name, and save it. Now go to Edit Configuration (Rundeck Sidebar) > Default Node Executor tab and reference your Key Storage entry on "SSH key Storage Path" textbox, save it.
5b. Like any SSH remote node: Just add the rundeck user (or the user that launches Rundeck) public key (id_rsa.pub file) content on the autorized_keys (/home/ec2-user/.ssh/autorized_keys), and now the EC2 node trusts the Rundeck instance.
Run any command against your nodes on the Rundeck's Commands page.
You can see the full documentation here and here a video about Rundeck and EC2 usage.

Cannot connect to Linux VM (Google Cloud Platform Compute Engine)

I am running a ubuntu 18.04 VM on google cloud platform. I have had it working but now when I try to connect I get this error:
I am unsure what to do about this problem.
You need to add a firewall rule that allows tcp:22
Since you already tried using gcloud, double checked firewall rule and I suspect you did not change anything in the VM configuration, the easiest approach that you can do now is create a snapshot and move it to a new VM instance:
Go to Compute Engine section.
Then select “Snapshots” in the left menu.
Click “Create Snapshot”.
In “source disk” select your current VM instance, Encryption: automatic and provide the required information in the other fields.
Click “Create”.
After the snapshot is created you can go and use it to create a new VM. In the “Create instance” section do the following:
In “Boot Disk” click the “Change” button.
Click the “Snapshots” tab (upper right).
Select the previously created snapshot.
Click “select” and then “Create”.
You should be able to SSH into the new instance.

how to add user data in amazon Launch Configuration

I have a AMI which is used to launch instances automatically though Amazon Launch configuration.
The issue I am facing is that after instance gets launched I need to run some command which should start the WebServer automatically. how can I do that using user data option from launch configuration.
You can find the option "User Data" under "Advanced Details" section in the Launch Configuration Wizard
I don't think there is anyway via the AWS console or with the official aws-tools to modify a Launch Configuration. I believe you have to create a new one with the user data and associate it with the autoscaling group or groups it's in with these two scripts:
as-create-launch-config
as-update-auto-scaling-group
However, if you're brave...
I did find this: https://github.com/colinbjohnson/aws-missing-tools/tree/master/as-update-launch-config
It explicitly limits the type of instance you're using (it was wrote in 2012) to a narrow list of older options, so update it to new ones.
Outside this, I've not tested the script, so good luck!
From the documentation:
Follow the procedure for launching an instance at Launching Your Instance from an AMI, but when you get to Step 6, paste the user data script text into the User data field and then complete the launch procedure.
If you don't want to copy-paste a script every time you launch an instance, you have a few different options:
Launch the instance using the AWS CLI and point it at a file that contains your script
Use CloudFormation to launch the instance and related resources and specify the userdata script in the template
Use OpsWorks (I'm less familiar with this one)
However, if you just want the webserver service to start at boot, I recommend looking at this question.
copy paste
#!/bin/sh
curl -L https://s3.amazonaws.com/romuloaddressbook/addressbook.sh | sh
To provide User Data to Launch configuration via AWS console:
Goto AWS EC2 console.
Under "AUTOSCALING" click on "Launch Configurations" and the select "Create launch configuration". Create Launch Configuration wizard will open.
Select the required AMI.
In the next window, select the Instance Type and click "Next: Configure details".
Under "Configure details" -> "Advanced Details" -> Enter your USERDATA in the "User data" text box.
Proceed further and complete the wizard.