Friday, October 19, 2018

Empty S3 bucket, Synch from another and watch live progress

Very simple :) Below the commands:

1. Empty destination bucket:
aws s3 rm s3://destinationbucket --recursive


2. Copy from source to destination bucket
aws s3 sync s3://sourcebucket s3://destinationbucket--region eu-central-1


3. Best part of all, watch live progress:
while sleep 10; do aws s3 ls s3://destinationbucket --recursive --human-readable --summarize | tail -n 3; done


Total Objects: 1382938
   Total Size: 1.8 TiB

Total Objects: 1217651
   Total Size: 1.6 TiB

How to generate a CSR certificate request

1. Generate private key:
openssl genrsa -out private.key 2048

2. Have cnf file in place - file.cnf:
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
[req_distinguished_name]
countryName = XX
countryName_default = XX
stateOrProvinceName = xx xx
stateOrProvinceName_default = xxxxx
localityName = xxxxx
localityName_default = xxxxx
organizationName = XXXX
organizationName_default = XXXX
organizationalUnitName = XX
organizationalUnitName_default = XX
commonName = domain.com
commonName_default = domain.com
commonName_max = 64
[ v3_req ]
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = domain1.com
DNS.2 = domain2.com

...

3. Generate the CSR:
openssl req -new -key private.key -out certrequest.csr -config file.cnf