I want to deploy my app to Amazon ec2(Ubuntu instance) when my tests will be succeed.
curl --ftp-create-dirs -T uploadfilename -u $FTP_USER:$FTP_PASSWORD ftp://sitename.com/directory/myfile
scp -i "[pemFileName].pem" [A File] [hostname]@ec2-02-50-258-231.eu-central-1.compute.amazonaws.com:~/.
Travis has the ability to encrypt/decrypt files stored in your git repository. You can store an encrypted version of your private key needed to
scp into your EC2 instance.
In my case I use a Bash script that, if the right conditions are satisfied, (1) decrypts the file according to Travis' instructions; and then (2)
scp's the build over to the EC2 instance using the decrypted .pem key.
Note that your
scp command should incorporate some way to deal with
StrictHostKeyChecking. This will disable it entirely:
scp -i [path/to/id/file] -o StringHostKeyChecking=no [source] [destination]
Though a more secure route is to get the host key fingerprint (e.g.,
ssh-keyscan [host]) and use as part of the
scp -i [path/to/id/file] -o UserKnownHostsFile=path/to/custom/known_hosts [source] [destination]