- Automating AWS Services with Scripting and the AWS CLI
a. Create Keypair: aws ec2 create-key-pair –key-name CLI
2. Bootstrap with user data
#!/bin/sh curl -L https://us-west-2-aws-training.s3.amazonaws.com/awsu-spl/spl03-working-elb/static/bootstrap-elb.sh | sh
1 2 3 4 5 6 7 8 |
#!/bin/sh yum -y install httpd php chkconfig httpd on /etc/init.d/httpd start cd /var/www/html wget https://us-west-2-aws-training.s3.amazonaws.com/awsu-spl/spl03-working-elb/static/examplefiles-elb.zip unzip examplefiles-elb.zip |
3. AWS Tools for Windows PowerShell: Getting Started
4. Deploy a Java EE Application on AWS Elastic Beanstalk Using Docker Containers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
// Install on EC2 sudo yum install -y docker sudo service docker start sudo chkconfig docker on // Download standard image sudo docker pull jboss/wildfly sudo docker images //Test container sudo docker run -it --rm jboss/wildfly // Create custom image cat > Dockerfile << EOF FROM jboss/wildfly RUN /opt/jboss/wildfly/bin/add-user.sh admin welcome1 --silent CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"] EOF sudo docker build --tag=wildfly-admin . // Run custom image sudo docker run -d -p 9990 -p 8080 -v /home/ec2-user/wildfly-admin/deploy:/opt/jboss/wildfly/standalone/deployments wildfly-admin sudo docker ps // Log sudo docker logs <CONTAINER_ID> sudo docker logs 78cacf7c4f05ce23a7a4fbc512cf057756d7b8f930ff233962a90d7be4ec2d79 32769->8080/tcp, 0.0.0.0:32768->9990/tcp |
5