Here’s how to copy an AMI to another region.
aws ec2 copy-image \ --source-image-id ami-xxxxxxxxxxx \ --source-region us-east-1 \ --region us-east-2 \ --name "My DR server" |
Output:
{ "ImageId": "ami-xxxxxxxxxxx" } |
cloud engineer
by Ulysses ·
Here’s how to copy an AMI to another region.
aws ec2 copy-image \ --source-image-id ami-xxxxxxxxxxx \ --source-region us-east-1 \ --region us-east-2 \ --name "My DR server" |
aws ec2 copy-image \ --source-image-id ami-xxxxxxxxxxx \ --source-region us-east-1 \ --region us-east-2 \ --name "My DR server"
Output:
{ "ImageId": "ami-xxxxxxxxxxx" } |
{ "ImageId": "ami-xxxxxxxxxxx" }
by Ulysses ·
If you need to copy a snapshot from one region to another, here’s the AWS CLI command.
aws ec2 copy-snapshot \ --region us-east-1 \ --source-region us-east-2 \ --source-snapshot-id snap-xxxxxxxxxxxxxxxxx \ --description "This is the DR snapshot copy" |
aws ec2 copy-snapshot \ --region us-east-1 \ --source-region us-east-2 \ --source-snapshot-id snap-xxxxxxxxxxxxxxxxx \ --description "This is the DR snapshot copy"
Output:
{ "SnapshotId": "snap-xxxxxxxxxxxxxxxxx" } |
{ "SnapshotId": "snap-xxxxxxxxxxxxxxxxx" }
by Ulysses ·
Here’s how to copy a symbolic link which is also known as a soft link from one directory to another. A regular copy command will not work. You will need to use the -P option to copy the symbolic link from one directory to another. If omitted, the symbolic links will not be copied.
cp -P /directory1/* /directory2/ |
cp -P /directory1/* /directory2/
How to create a symbolic link.
ln -s sourcefile myfile ln -s /path/to/file myfile |
ln -s sourcefile myfile ln -s /path/to/file myfile
by Ulysses ·
SCP is a secure copy utility in Linux. You’ll need access to your system. In this example, a pem key is used to authenticate to a host. SCP copies filename.ext to the home directory of ec2-user. It’s important to add the target directory, otherwise it will not work.
Here’s how to use SCP with a key from local to server.
scp -i key.pem filename.ext user@server:/home/user |
scp -i key.pem filename.ext user@server:/home/user
From server to local. Run the command from local machine.
scp user@server:/home/user/file.txt /local/directory |
scp user@server:/home/user/file.txt /local/directory
by Ulysses ·
I was getting an error when launching Audacity.
The error was:
“The system has detected that another copy of Audacity is running.”
However, Audacity wasn’t running at all. Not one process. It turned out to be just a locked file located in /var/tmp/audacity-[your-username].
All you have to do is delete the entire directory and rerun Audacity.
rm -rf /var/tmp/audacity=[your-username]/ |
rm -rf /var/tmp/audacity=[your-username]/
Once deleted, Audacity starts right up with no issues.
by Ulysses ·
Here’s the command to copy a secret key to a remote server.
ssh-copy-id user@servername |
ssh-copy-id user@servername
This assumes you already generated a key.
by Ulysses ·
Here’s how to sync S3 buckets between 2 different AWS accounts. Assuming buckets are already created.
Account A bucket permissions. Account and user are from Account B.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "DelegateS3Access", "Effect": "Allow", "Principal": {"AWS": "arn:aws:iam::222222222222:user/Jane"}, "Action": ["s3:ListBucket","s3:GetObject"], "Resource": [ "arn:aws:s3:::awsexamplesourcebucket/*", "arn:aws:s3:::awsexamplesourcebucket" ] } ] } |
{ "Version": "2012-10-17", "Statement": [ { "Sid": "DelegateS3Access", "Effect": "Allow", "Principal": {"AWS": "arn:aws:iam::222222222222:user/Jane"}, "Action": ["s3:ListBucket","s3:GetObject"], "Resource": [ "arn:aws:s3:::awsexamplesourcebucket/*", "arn:aws:s3:::awsexamplesourcebucket" ] } ] }
Create IAM user (Jane) in Account B
aws iam create-user --user-name Jane |
aws iam create-user --user-name Jane
Give IAM user (Jane) access to both buckets.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::awsexamplesourcebucket", "arn:aws:s3:::awsexamplesourcebucket/*" ] }, { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:PutObject", "s3:PutObjectAcl" ], "Resource": [ "arn:aws:s3:::awsexampledestinationbucket", "arn:aws:s3:::awsexampledestinationbucket/*" ] } ] } |
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::awsexamplesourcebucket", "arn:aws:s3:::awsexamplesourcebucket/*" ] }, { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:PutObject", "s3:PutObjectAcl" ], "Resource": [ "arn:aws:s3:::awsexampledestinationbucket", "arn:aws:s3:::awsexampledestinationbucket/*" ] } ] }
Sync the buckets
aws s3 sync s3://awsexamplesourcebucket s3://awsexampledestinationbucket |
aws s3 sync s3://awsexamplesourcebucket s3://awsexampledestinationbucket
by Ulysses ·
Subversion Branch creates a new branch in the local working directory. In the example below, a copy of the project directory is forked and given a new name. The new branch will be treated as a separate branch.
svn copy http://repository/project/trunk \ http://repository/project/branch/newbranch \ -m "Place comments here." |
svn copy http://repository/project/trunk \ http://repository/project/branch/newbranch \ -m "Place comments here."