Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
126 views27 pages

Notes Aws

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 27

$ aws ec2 describe-images --filters "Name=description,Values=Amazon Linux AMI * x86_64 HVM GP2" --

query 'Images[*].[CreationDate, Description, ImageId]' --output text | sort -k 1 | tail

$ aws ec2 describe-vpcs

$ aws ec2 create-security-group \

--group-name HelloWorld \

--description "Hello World Demo" \

--vpc-id vpc-4cddce2a

$ aws ec2 authorize-security-group-ingress \

--group-name HelloWorld \

--protocol tcp \

--port 22 \

--cidr 0.0.0.0/0

$ aws ec2 authorize-security-group-ingress \

--group-name HelloWorld \

--protocol tcp \

--port 3000 \

--cidr 0.0.0.0/0

$ aws ec2 describe-security-groups \

--group-names HelloWorld \

--output text

$ aws ec2 create-key-pair --key-name EffectiveDevOpsAWS --query


'KeyMaterial' --output text >~/.ssh/EffectiveDevOpsAWS.pem

$ aws ec2 describe-key-pairs --key-name EffectiveDevOpsAWS

"KeyPairs": [

"KeyName": "EffectiveDevOpsAWS",

"KeyFingerprint":

"27:83:5d:9b:4c:88:f6:15:c7:39:df:23:4f:29:21:3b:3d:49:e6:af"

$ cat ~/.ssh/EffectiveDevOpsAWS.pem

-----BEGIN RSA PRIVATE KEY-----

MIIEpAIBAAKCAQEAiZLtUMnO2OKnHvTJOiIP26fThdsU0YRdlKI60in85x9aFZXSrZsKwOhWPpMtnUMJKeGv
VQut+gJ1I1PNNjPqS2Dy60jH55hntUhrArpaL2ISDX4BgRAP1jcukBqS6+pL+mTp6OUNTToUt7LvAZoeo+10S
YbzHF1ZMQLLs96fCMNvnbJdUCa904dJjJs7t/
G2ou9RiNMRx8midrWcmmuGKOb1s6FgrxJ5OAMYegeccFVfGOjqPk3f+6QTPOTMNgNQ8ANKOMA9YtcIca
/75QGUPifusTqUT4Fqtv3rbUYPvacAnYL9eCthtn1XMG7Oo/
mR5MrU60wib2QcPipmrGNbwIDAQABAoIBABSyqkmxUxGGaCZcJbo9Ta16fnRxFZzAEWQ/
VCIydv4+1UrSE7RS0zdavT8E3aP/Ze2LKtncu/
wVSpJaFVHGVcWpfGKxvIG3iELZ9oUhDyTWx3+IKanFRNyxyKudk+UyhuPRMu/
7JhksV9mbbiILkfiPzSMSzpjB4p1hEkypfbvBnrbB+sRycx+jK5l209rNDukkJVvyFCnqPiH0wmvKRqHTNOMGW
mM6CPOU+VpuMX+dIlrSeId7j6hqMjA0rGncnxYi035v2zicvIsEKHZ9MZCnkiRb3kJ9PhueTwwUQmoBYfV5E
+1Wu34UmdsmALQEX3xniaR6xf9iWhQ2Nh8LaECgYEAzXHOZDPAUzXitO735KBUaiBp9NMv2gzE862Yf2r
mDkFM4Y5RE3DKHrKfeOkrYqlG11On0m44GHBk/g4eqqIEaBjVp6i/
Lk74tpQU6Kn1HT3w9lbXEFsCWjYZnev5oHP6PdedtRYNzZsCSNUdlw0kOG5WZZJ4E7mPZyrvK5pq+rMCgY
EAq22KT0nD3d59V+LVVZfMzJuUBDeJeD139mmVbzAq9u5Hr4MkurmcIj8Q6jJIQaiC8XC1gBVEl08ZN2oY1
+CBE+Gesi7mGOQ2ovDmoTfYRgScKKHv7WwR+N5/
N7o26x+ZaoeaBe43Vjp6twaTpKkBOIuT50tvb25v9+UVMpGKcFUC

gYEAoOFjJ3KjREYpT1jnROEM2cKiVrdefJmNTel+RyF2IGmgg+1Hrjqf/
OQSH8QwVmWK9SosfIwVX4X8gDqcZzDS1JXGEjIB7IipGYjiysP1D74myTF93u/
16qD89H8LD0xjBTSo6lrn2j9tzY0eS+Bdodc9zvKhF4kzNC4Z9wJIjiMCgYAOtqstXP5zt5n4hh6bZxkL4rqUlhO1
f0khnDRYQ8EcSp1agh4P7Mhq5BDWmRQ8lnMOuAbMBIdLmV1ntTKGrN1HUJEnaAEV19icqaKR6dIlSFYC4
stODH2KZ8ZxiQkXqzGmxBbDNYwIWaKYvPbFJkBVkx1Rt9bLsKXpl/
72xSkltQKBgQCYEjUVp4dPzZL1CFryOwV72PMMX3FjOflTgAWr8TJBq/
OLujzgwYsTy6cdD3AqnMQ2BlU7Gk4mmDZCVVsMqHFbIHEa5Y4e5qIQhamedl3IgmnMpdyuDYaT/
Uh4tw0JxIJabqm+sQZv4s1Otgh00JlGrgFs+0D39Fy8qszqr6J04w==

-----END RSA PRIVATE KEY-----

$ chmod 400 ~/.ssh/EffectiveDevOpsAWS.pem

$ aws ec2 run-instances \

--instance-type t2.micro \

--key-name EffectiveDevOpsAWS \

--security-group-ids sg-01864b4c \

--image-id ami-cfe4b2b0

$ aws ec2 describe-instance-status --instance-ids i-057e8deb1a4c3f35d

$ aws ec2 describe-instance-status --instance-ids i-057e8deb1a4c3f35d --output text| grep -i

SystemStatus

SYSTEMSTATUS ok

$ aws ec2 describe-instances \

--instance-ids i-057e8deb1a4c3f35d \

--query "Reservations[*].Instances[*].PublicDnsName"
$ ssh -i ~/.ssh/EffectiveDevOpsAWS.pem ec2-user@ ec2-34-201-101-26.compute-1.amazonaws.com

[ec2-user@ip-172-31-22-52 ~]$ sudo yum install --enablerepo=epel -y nodejs

[ec2-user@ip-172-31-22-52 ~]$ node -v

v0.10.48

[ec2-user@ip-172-31-22-52 ~]$

wget https://raw.githubusercontent.com/yogeshraheja/Effective-DevOps-with-AWS/master/
Chapter02/helloworld.js -O /home/ec2-user/helloworld.js

--2018-08-19 13:06:42-- https://raw.githubusercontent.com/yogeshraheja/Effective-DevOps-with-


AWS/master/Chapter02/helloworld.js

Resolving raw.githubusercontent.com (raw.githubusercontent.com)...

151.101.200.133

Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.200.133|:443...


connected.

HTTP request sent, awaiting response... 200 OK

Length: 384 [text/plain]

Saving to: ‘/home/ec2-user/helloworld.js’

/home/ec2-user/helloworld.js 100%
[====================================================================================
=100%
[====================================================================================
=>] 384 --.-KB/s in 0s

2018-08-19 13:06:42 (37.9 MB/s) - ‘/home/ec2-user/helloworld.js’ saved [384/384]


[ec2-user@ip-172-31-22-52 ~]$

[ec2-user@ip-172-31-22-52 ~]$node helloworld.js

Server running

Ctrl + C

etc/init/helloworld.conf

description "Hello world Daemon"

# Start when the system is ready to do networking. Start on started elastic-network-interfaces

# Stop when the system is on its way down. Stop on shutdown

respawn script

exec su --session-command="/usr/bin/node /home/ec2-user/helloworld.js" ec2-user

end script

[ec2-user@ip-172-31-22-52 ~]$

sudo wget https://raw.githubusercontent.com/yogeshraheja/Effective-DevOps-with-AWS/master/


Chapter02/helloworld.conf -O /etc/init/helloworld.conf

--2018-08-19 13:09:39-- https://raw.githubusercontent.com/yogeshraheja/Effective-DevOps-with-


AWS/master/Chapter02/helloworld.conf

Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.200.133

Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.200.133|:443...


connected.

HTTP request sent, awaiting response... 200 OK

Length: 301 [text/plain]


Saving to: ‘/etc/init/helloworld.conf’

/etc/init/helloworld.conf 100%
[====================================================================================
=>] 301 --.-KB/s in 0s

2018-08-19 13:09:39 (54.0 MB/s) - ‘/etc/init/helloworld.conf’ saved [301/301]

[ec2-user@ip-172-31-22-52 ~]$

[ec2-user@ip-172-31-22-52 ~]$ sudo start helloworld

helloworld start/running, process 2872

[ec2-user@ip-172-31-22-52 ~]$

[ec2-user@ip-172-31-22-52 ~]$ sudo stop helloworld

$ aws cloudformation help # for the list of options

helloworld stop/waiting

[ec2-user@ip-172-31-22-52 ~]$ ec2-metadata --instance-id

instance-id: i-057e8deb1a4c3f35d

[ec2-user@ip-172-31-22-52 ~]$ exit

logout

$ aws ec2 terminate-instances --instance-ids i-057e8deb1a4c3f35d


$ pip install troposphere

setuptools_scm.version.SetuptoolsOutdatedWarning: your setuptools is too old (<12)

-----------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-pW4aV4/cfn-flip/

pip install -U setuptools

Collecting setuptools

Downloading
https://files.pythonhosted.org/packages/ff/f4/385715ccc461885f3cedf57a41ae3c12b5fec3f35cce4c870
6b1a112a133/setuptools-40.0.0-py2.py3-none-any.whl (567kB)

100% |████████████████████████████████| 573kB 22.2MB/s

Installing collected packages: setuptools

Found existing installation: setuptools 0.9.8

Uninstalling setuptools-0.9.8:

Successfully uninstalled setuptools-0.9.8

Successfully installed setuptools-40.0.0

helloworld-cf-template.py

"""Generating CloudFormation template."""

from troposphere import (

Base64,

ec2,

GetAtt,
Join,

Output,

Parameter,

Ref,

Template,

ApplicationPort = "3000"

t = Template()

add_description("Effective DevOps in AWS: HelloWorld web application")

t.add_parameter(Parameter(

"KeyPair",

Description="Name of an existing EC2 KeyPair to SSH",

Type="AWS::EC2::KeyPair::KeyName",

ConstraintDescription="must be the name of an existing EC2 KeyPair.",

))

t.add_resource(ec2.SecurityGroup(

"SecurityGroup",

GroupDescription="Allow SSH and TCP/{}

access".format(ApplicationPort),

SecurityGroupIngress=[

ec2.SecurityGroupRule(

IpProtocol="tcp",

FromPort="22",
ToPort="22",

CidrIp="0.0.0.0/0",

),

ec2.SecurityGroupRule(

IpProtocol="tcp",

FromPort=ApplicationPort,

ToPort=ApplicationPort,

CidrIp="0.0.0.0/0",

),

],

))

***http://amzn.to/1VU5b3s

ud = Base64(Join('\n', [

"#!/bin/bash",

"sudo yum install --enablerepo=epel -y nodejs",

"wget http://bit.ly/2vESNuc -O /home/ec2-user/helloworld.js",

"wget http://bit.ly/2vVvT18 -O /etc/init/helloworld.conf",

"start helloworld"

]))

...

t.add_resource(ec2.Instance(

"instance",

ImageId="ami-cfe4b2b0",

InstanceType="t2.micro",

SecurityGroups=[Ref("SecurityGroup")],

KeyName=Ref("KeyPair"),
UserData=ud,

))

...

***Fn::GetAtt

***GetAtt()

...

t.add_output(Output(

"InstancePublicIp",

Description="Public IP of our instance.",

Value=GetAtt("instance", "PublicIp"),

))

t.add_output(Output(

"WebUrl",

Description="Application endpoint",

Value=Join("", [

"http://", GetAtt("instance", "PublicDnsName"),

":", ApplicationPort

]),

))

...

print t.to_json()

***link:  https://raw.githubusercontent.com/yogeshraheja/Effective-DevOps-with-AWS/master/
Chapter03/EffectiveDevOpsTemplates/helloworld-cf-template-part-1.py
$ python helloworld-cf-template.py >helloworld-cf.template

***documentation at http://bit.ly/1W6s96M

***yum -y install git

$ git clonehttps://github.com/<your_github_username>/EffectiveDevOpsTemplates

$ cd EffectiveDevOpsTemplates

EffectiveDevOpsTemplates

$ cp <path_to_helloworld_template>/helloworld-cf-template.py

$ git add helloworld-cf-template.py

$ git commit -m "Adding helloworld Troposphere template"

$ git push

***https://api.ipify.org

$ curl https://api.ipify.org 54.164.95.231

***$ pip install ipify


Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine
which files belong to it which would lead to only a partial uninstall.

$ pip install --upgrade --force-reinstall pip==9.0.3

$ pip install ipify

$ pip install --upgrade pip

$ pip install ipaddress

...

from ipaddress import ip_network

from ipify import get_ip

from troposphere import (

Base64,

ec2,

GetAtt,

Join,

Output,

Parameter,

Ref,

Template,

ApplicationPort = "3000"

PublicCidrIp = str(ip_network(get_ip()))

...

SecurityGroupIngress=[
ec2.SecurityGroupRule(

IpProtocol="tcp",

FromPort="22",

ToPort="22",

CidrIp=PublicCidrIp,

),

....

https://github.com/yogeshraheja/Effective-DevOps-with-AWS/blob/master/Chapter03/
EffectiveDevOpsTemplates/helloworld-cf-template.py.

python helloworld-cf-template.py >helloworld-cf-v2.template

$ diff helloworld-cf-v2.template helloworld-cf.template

46c46

<"CidrIp":"54.164.95.231/32",

---

>"CidrIp": "0.0.0.0/0",

91a92

>

$ aws ec2 describe-security-groups \

--group-names HelloWorld-SecurityGroup-1XTG3J074MXX

***change sets

$ git commit -am "Only allow ssh from our local IP"
$ git push

***Puppet, Chef,SaltStack, and Ansible

***AWS OpsWorks and its Chef integration

***about this at http://amzn.to/1O8dTsn

***https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-the-
control-machine.)

$ yum install ansible

$ ansible --version

ansible 2.6.2

config file = /etc/ansible/ansible.cfg

configured module search path = [u'/root/.ansible/plugins/modules',

u'/usr/share/ansible/plugins/modules']

ansible python module location = /usr/lib/python2.7/site-

packages/ansible

executable location = /bin/ansible

python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5

20150623 (Red Hat 4.8.5-16)]

$ aws cloudformation create-stack \


--capabilities CAPABILITY_IAM \

--stack-name ansible \

--template-body file://helloworld-cf-v2.template \

--parameters ParameterKey=KeyPair,ParameterValue=EffectiveDevOpsAWS

"StackId": "arn:aws:cloudformation:us-east-

1:094507990803:stack/ansible/bb29cb10-9bbe-11e8-9ee4-500c20fefad2"

$ git clone https://github.com/<your_github_username>/ansible

$ cd ansible

$ curl -Lo ec2.py http://bit.ly/2v4SwE5

$ chmod +x ec2.py

***ec2.ini

[ec2]

regions = all

regions_exclude = us-gov-west-1,cn-north-1 destination_variable = public_dns_name


vpc_destination_variable = ip_address route53 = False

cache_path = ~/.ansible/tmp cache_max_age = 300

rds = False

$ ./ec2.py

***ansible.cfg

[defaults]

inventory = ./ec2.py
remote_user = ec2-user

become = True

become_method = sudo

become_user = root

nocows = 1

http://bit.ly/24rU0yk

$ ansible-doc <Module-Name>

$ ansible-doc ping

$ ansible --private-key ~/.ssh/EffectiveDevOpsAWS.pem ec2 -m ping

18.206.223.199 | SUCCESS =>{

"changed": false,

"ping": "pong"

------------

$HOME/.ssh/config

IdentityFile ~/.ssh/EffectiveDevOpsAWS.pem

User ec2-user StrictHostKeyChecking no

PasswordAuthentication no

ForwardAgent yes

$ ansible --private-key ~/.ssh/EffectiveDevOpsAWS.pem '18.206.223.*' \

-a 'df -h'

18.206.223.199 | SUCCESS | rc=0 >>


Filesystem Size Used Avail Use% Mounted on

devtmpfs 484M 56K 484M 1% /dev

tmpfs 494M 0 494M 0% /dev/shm

/dev/xvda1 7.8G 1.1G 6.6G 15% /

***playbook

***https://github.com/ansible/ansible-examples

***https://github.com/yogeshraheja/Automation-with-Ansible-By-Yogesh-Raheja

***http://bit.ly/1ZqdcLH

yum install --enablerepo=epel -y nodejs wget http://bit.ly/2vESNuc -O /home/ec2-user/helloworld.js

wget http://bit.ly/2vVvT18 -O /etc/init/helloworld.conf start helloworld

$ mkdir roles

$ cd roles

***https://galaxy.ansible.com/

$ cd nodejs

ansible-galaxy init nodejs

- nodejs was created successfully

# tasks file for nodejs

# tasks file for nodejs


***http://bit.ly/28joDLe

---

# tasks file for nodejs

name: Installing node and npm yum:

name: "{{ item }}" enablerepo: epel state: installed

with_items:

nodejs

npm

***https://github.com/yogeshraheja/Effective-DevOps-with-AWS/blob/master/Chapter03/ansible/
roles/nodejs/tasks/main.yml

$ cd ..

$ ansible-galaxy init helloworld

- helloworld was created successfully

$ cd helloworld

***files

$ wget http://bit.ly/2vESNuc -O files/helloworld.js

$ wget http://bit.ly/2vVvT18 -O files/helloworld.conf

tasks/main.yml
---

# tasks file for helloworld

- name: Copying the application file copy:

src: helloworld.js dest: /home/ec2-user/ owner: ec2-user group: ec2-user

mode: 0644

notify: restart helloworld

***http://bit.ly/1WBv08E

- name: Copying the upstart file copy:

src: helloworld.conf

dest: /etc/init/helloworld.conf owner: root

group: root mode: 0644

***//bit.ly/22I7QNH

- name: Starting the HelloWorld node service service:

name: helloworld state: started

***https://github.com/yogeshraheja/Effective-DevOps-with-AWS/blob/master/Chapter03/ansible/
roles/helloworld/tasks/main.yml

handlers/main.yml

---
# handlers file for helloworld

- name: restart helloworld service:

name: helloworld state: restarted

meta/main.yml

dependencies:

- nodejs

***https://github.com/yogeshraheja/Effective-DevOps-with-AWS/blob/master/Chapter03/ansible/
roles/helloworld/meta/main.yml

helloworld.yml

---

- hosts: "{{ target | default('localhost') }}" become: yes

roles:

- helloworld

***https://github.com/yogeshraheja/Effective-DevOps-with-AWS/tree/master/Chapter03/ansible

***---

hosts: webservers roles:

foo

bar

baz
ansible-playbook <playbook.yml>[options]

$ ansible-playbook helloworld.yml \

--private-key ~/.ssh/EffectiveDevOpsAWS.pem \

-e target=ec2 \

--list-hosts

playbook: helloworld.yml

play #1 (ec2): ec2 TAGS:[]

pattern: [u'ec2']

hosts (1):

18.206.223.199

dry-run

$ ansible-playbook helloworld.yml \

--private-key ~/.ssh/EffectiveDevOpsAWS.pem \

-e target=18.206.223.199 \

--check

PLAY [18.206.223.199]
*************************************************************************************
*************************************************************

TASK [Gathering Facts]


*************************************************************************************
*************************************************************************************
*************************************************************************************
***********************************

ok: [18.206.223.199]
TASK [nodejs : Installing node and npm]
*************************************************************************************
*******************************************

changed: [18.206.223.199] =>(item=[u'nodejs', u'npm'])

TASK [helloworld : Copying the application file]


*************************************************************************************
*************************************************************************************
********************************************************************

changed: [18.206.223.199]

TASK [helloworld : Copying the upstart file]


*************************************************************************************
**************************************

changed: [18.206.223.199]

TASK [helloworld : Starting the HelloWorld node service]

*************************************************************************************
**************************

changed: [18.206.223.199]

RUNNING HANDLER [helloworld : restart helloworld]


*************************************************************************************
*********************************

changed: [18.206.223.199]

PLAY RECAP
*************************************************************************************
************************************************************************

18.206.223.199 : ok=6 changed=5 unreachable=0 failed=0

$ ansible-playbook helloworld.yml \
--private-key ~/.ssh/EffectiveDevOpsAWS.pem \

-e target=18.206.223.199

$ curl 18.206.223.199:3000

Hello World

$ git add ansible.cfg ec2.ini ec2.py

$ git commit -m "Configuring ansible to work with EC2"

$ git add roles helloworld.yml

$ git commit -m "Adding role for nodejs and helloworld"

$ git push

***canary testing

roles/helloworld/files/helloworld.js

// Send the response body as "Hello World"

response.end('Hello World, Welcome again\n');

}).listen(3000);

$ ansible-playbook helloworld.yml \

--private-key ~/.ssh/EffectiveDevOpsAWS.pem\

-e target=18.206.223.199 \

--check

$ ansible-playbook helloworld.yml \

--private-key ~/.ssh/EffectiveDevOpsAWS.pem \-e target=18.206.223.199


$ curl 18.206.223.199:3000

Hello World, Welcome again

$ git checkout roles/helloworld/files/helloworld.js

$ ansible '18.206.223.199' \

--private-key ~/.ssh/EffectiveDevOpsAWS.pem \

--become \

-m yum -a 'name=git enablerepo=epel state=installed'

$ ansible '18.206.223.199' \

--private-key ~/.ssh/EffectiveDevOpsAWS.pem \

--become \

-m yum -a 'name=ansible enablerepo=epel state=installed'

localhost

[localhost]

localhost

ansible_connection=local

$ git add localhost

$ git commit -m "Adding localhost inventory"

$ git push

$ ansible '18.206.223.199' \

--private-key ~/.ssh/EffectiveDevOpsAWS.pem\
-m cron -a 'name=ansible-pull minute="*/10" job="/usr/bin/ansible-pull -U
https://github.com/<your_username>/ansible helloworld.yml -i localhost --sleep 60"'

$ curl 54.175.86.38:3000

Hello World

ansiblebase-cf-template.py.

$ cd EffectiveDevOpsTemplates

$ cp helloworld-cf-template.py ansiblebase-cf-template.py

ansiblebase-cf-template.py

ApplicationName = "helloworld"

ApplicationPort = "3000"

ApplicationPort = "3000"

GithubAccount ="EffectiveDevOpsWithAWS"

GithubAnsibleURL = "https://github.com/{}/ansible".format(GithubAccount)

AnsiblePullCmd = \

"/usr/bin/ansible-pull -U {} {}.yml -i localhost".format( GithubAnsibleURL,

ApplicationName

ud = Base64(Join('\n', [ "#!/bin/bash",
"yum install --enablerepo=epel -y git", "pip install ansible",

AnsiblePullCmd,

"echo '*/10 * * * * {}' >/etc/cron.d/ansible- pull".format(AnsiblePullCmd)

]))

***//github.com/yogeshraheja/EffectiveDevOpsTemplates/blob/master/ansiblebase-cf-template.py

$ python ansiblebase-cf-template.py >ansiblebase.template

$ aws cloudformation update-stack \

--stack-name ansible \

--template-body file://ansiblebase.template \

--parameters ParameterKey=KeyPair,ParameterValue=EffectiveDevOpsAWS

"StackId": "arn:aws:cloudformation:us-east-1:511912822958:stack/HelloWorld/ef2c3250-6428-11e7-
a67b-50d501eed2b3"

$ aws cloudformation create-stack \

--stack-name helloworld \

--template-body file://ansiblebase.template \

--parameters ParameterKey=KeyPair,ParameterValue=EffectiveDevOpsAWS

"StackId": "arn:aws:cloudformation:us-east-

1:094507990803:stack/helloworld/5959e7c0-9c6e-11e8-b47f-

50d5cd26c2d2"

}
$ aws cloudformation wait stack-update-complete \

--stack-name ansible

$ aws cloudformation describe-stacks \

--stack-name ansible \

--query 'Stacks[0].Outputs[0]'

"Description": "Public IP of our instance.",

"OutputKey": "InstancePublicIp",

"OutputValue":"35.174.138.51"

You might also like