AWS Cheat Sheet

AWS Cheat Sheet

in

๐Ÿ”Ž AWS Cloud

Cloud ๊ธฐ๋ณธ ์ง€์‹

Cloud ๋ž€?

ํด๋ผ์šฐ๋“œ ์ปดํ“จํŒ…์ด๋ž€ ์ธํ„ฐ๋„ท ๊ธฐ๋ฐ˜์˜ ์ปดํ“จํŒ…์„ ๋งํ•ฉ๋‹ˆ๋‹ค. ์ธํ„ฐ๋„ท ์ƒ์˜ ๊ฐ€์ƒํ™”๋œ ์„œ๋ฒ„์— ํ”„๋กœ๊ทธ๋žจ์„ ๋‘๊ณ  ํ•„์š”ํ• ๋•Œ๋งˆ๋‹ค ์ปดํ“จํ„ฐ๋‚˜ ์Šค๋งˆํŠธํฐ ๋“ฑ์— ๋ถˆ๋Ÿฌ์™€ ์‚ฌ์šฉํ•˜๋Š” ์„œ๋น„์Šค์ž…๋‹ˆ๋‹ค.

ํด๋ผ์šฐ๋“œ(Cloud)๋ผ๋Š” ๋‹จ์–ด๊ฐ€ ๋งํ•ด์ฃผ๋“ฏ, ์ธํ„ฐ๋„ท ํ†ต์‹ ๋ง ์–ด๋”˜๊ฐ€์—์„œ ๊ตฌ๋ฆ„์— ์‹ธ์—ฌ ๋ณด์ด์ง€ ์•Š๋Š” ์ปดํ“จํŒ… ์ž์›(CPU, ๋ฉ”๋ชจ๋ฆฌ, ๋””์Šคํฌ ๋“ฑ)์„ ์›ํ•˜๋Š” ๋Œ€๋กœ ๊ฐ€์ ธ๋‹ค ์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ตฌ๋ฆ„์— ์‹ธ์—ฌ ์žˆ๋‹ค๋Š” ๊ฒƒ์€ ๊ทธ ๋‚ด๋ถ€๋ฅผ ๋ณด๋ ค๊ณ  ํ•˜๊ฑฐ๋‚˜ ์•Œ์ง€ ์•Š์•„๋„ ์–ผ๋งˆ๋“ ์ง€ ๋‚ด๊ฐ€ ์›ํ•˜๋Š” ๊ฒƒ์„ ๊บผ๋‚ด์–ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ์ด๋ฉฐ, ์ธํ„ฐ๋„ท์ด ์—ฐ๊ฒฐ๋œ ์–ด๋Š ๊ณณ์—์„œ๋“  ์ด๊ฒƒ์„ ๋ณด์žฅ ๋ฐ›์„ ์ˆ˜ ์žˆ๋‹ค๋Š” ๋œป์ž…๋‹ˆ๋‹ค.

AWS(Amazon Web Service), Microsoft Azure, GCP(Google Cloud Platform) ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

ํด๋ผ์šฐ๋“œ ํ”Œ๋žซํผ ๋ณ„ ์šฉ์–ด

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2022-06-01 แ„‹แ…ฉแ„’แ…ฎ 4 52 38

ํด๋ผ์šฐ๋“œ ์ปดํ“จํŒ… ์„œ๋น„์Šค ์ด์šฉ๋ฐฉ์‹

  • ์˜จํ”„๋ ˆ๋ฏธ์Šค = ์ง์ ‘ ์„œ๋ฒ„๋ฅผ ์„ค์น˜ํ•˜๋Š” ๊ฒƒ ์ฆ‰, ํ•˜๋“œ์›จ์–ด ๋ถ€๋ถ„๊ณผ ์†Œํ”„ํŠธ์›จ์–ด ๋ถ€๋ถ„์„ ๋‘˜๋‹ค ์ง์ ‘ ๊ด€๋ฆฌ
  • ํด๋ผ์šฐ๋“œ (IaaS / Paas) = ๋ˆ์„ ๋‚ด๋ฉด ์ตœ์‹ ์‹ ์„œ๋ฒ„๋ฅผ ์‚ฌ์šฉ ๊ฐ€๋Šฅ, ์†Œํ”„ํŠธ์›จ์–ด์ ์ธ ๋ถ€๋ถ„์€ ์‚ฌ์šฉ์ž๊ฐ€ ์ง์ ‘ ๊ด€๋ฆฌ
  • ์„œ๋ฒ„๋ฆฌ์Šค (BaaS/FaaS) = ์„œ๋ฒ„๋ฅผ ๊ด€๋ฆฌํ•  ํ•„์š” ์—†์ด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋นŒ๋“œํ•˜๊ณ  ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ์ œ๊ณต, ์„œ๋ฒ„๋ฆฌ์Šค์— ์—…๋กœ๋“œ ํ•œ ํ•จ์ˆ˜๊ฐ€ 24์‹œ๊ฐ„ ๋Œ์•„๊ฐ€๋Š”๊ฒŒ ์•„๋‹Œ ํ•„์š” ์‹œ ์š”์ฒญํ•˜์—ฌ ์ž‘์—… ์ˆ˜ํ–‰ (AWS ๋žŒ๋‹ค)

AWS ์ฃผ์š” ์„œ๋น„์Šค

  • Amazon S3(Simple Storage Service) = ๋ฐ์ดํ„ฐ ์Šคํ† ๋ฆฌ์ง€ ์„œ๋น„์Šค๋กœ Bucket๊ณผ Object ๋ผ๋Š” ๋‹จ์œ„๊ฐ€ ์กด์žฌํ•˜๋Š”๋ฐ ๊ฐ์ฒด(Object)๋Š” ๋ฐ์ดํ„ฐ์™€ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋ฅผ ๊ตฌ์„ฑํ•˜๊ณ  ์žˆ๋Š” ์ €์žฅ ๋‹จ์œ„์ด๋ฉฐ ๋ฒ„ํ‚ท(Bucket)์€ ์ด๋Ÿฌํ•œ ๊ฐ์ฒด๋ฅผ ์ €์žฅํ•˜๊ณ  ๊ด€๋ฆฌํ•˜๋Š” ์—ญํ™œ
  • Amazon RDS(Realational Database Service) = ๊ด€๊ณ„ํ˜• ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ธ AuroraDB, MSSQL, Oracle, MySQL ๋“ฑ์œผ๋กœ RDBMS ์„œ๋น„์Šค๋ฅผ ์‚ฌ์šฉ์ž๊ฐ€ ์ง์ ‘ ๊ด€๋ฆฌํ•˜์ง€ ์•Š๊ณ  ์ด์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ์ œ๊ณต
  • Amazon DynamoDB = NoSQL์šฉ ์„œ๋น„์Šค๋กœ ๋Œ€๋Ÿ‰์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅ, ์ถ”๊ฐ€ ๋ถ„์„ ์„œ๋น„์Šค์™€ ์—ฐ๊ณ„ ๊ฐ€๋Šฅํ•˜๋„๋ก ์„œ๋น„์Šค ์ œ๊ณต

์„œ๋ฒ„๋ฆฌ์Šค ์„œ๋น„์Šค

  • AWS Lambda = ์ฝ”๋“œ๋ฅผ ์†Œ์œ ํ•˜์ง€ ์•Š์•„๋„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋Ÿฐํƒ€์ž„ ํ™˜๊ฒฝ์„ ์ œ๊ณตํ•˜๋Š” ์„œ๋น„์Šค, ์ฝ”๋“œ๋ฅผ ์—…๋กœ๋“œํ•˜๊ณ  ํŠธ๋ฆฌ๊ฑฐํ•˜๊ฑฐ๋‚˜ ์ง์ ‘ ํ˜ธ์ถœํ•˜์—ฌ ์‚ฌ์šฉ ๊ฐ€๋Šฅ
  • Amazon API Gateway = REST ๋ฐ API๋ฅผ ์ƒ์„ฑ,๊ฒŒ์‹œ,์œ ์ง€ ๋ชจ๋‹ˆํ„ฐ๋ง. ํ”„๋ก ํŠธ ์›น์—์„œ ๋ฐฑ์—”๋“œ๋กœ ๋ฐ์ดํ„ฐ ์ „์†ก ์‹œ ๋žŒ๋‹ค์™€ ํ•จ๊ป˜ ์‚ฌ์šฉ
  • Amazon Cognito = ์›น ๋ฐ ์•ฑ์— ๋Œ€ํ•œ ์ธ์ฆ, ๊ถŒํ•œ ๋ถ€์—ฌ ์‚ฌ์šฉ์ž ๊ด€๋ฆฌ, OAuth ๋ฐ ํƒ€์‚ฌ ์ธ์ฆ์„ ํ†ตํ•ด ๋กœ๊ทธ์ธ ๊ฐ€๋Šฅ

Cloud ์‚ฌ์šฉ์ž ๊ด€๋ฆฌ

AWS์—๋Š” Root๊ณ„์ •๊ณผ IAM(๊ฐœ์ธ) ๊ณ„์ • 2๊ฐœ๊ฐ€ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค.

  • root ์‚ฌ์šฉ์ž

= AWS ๊ณ„์ •์„ ์ฒ˜์Œ ์ƒ์„ฑํ•  ๋•Œ ๊ณ„์ •์˜ ๋ชจ๋“  AWS ๋ฆฌ์†Œ์Šค์— ์•ก์„ธ์Šค ๊ถŒํ•œ์ด ์žˆ๋Š” ID
= ์ด๋ฉ”์ผ ์ฃผ์†Œ์™€ ์•”ํ˜ธ๋ฅผ ์ด์šฉํ•˜์—ฌ ์ธ์ฆ
= ์ผ์ƒ์ ์ธ ์ž‘์—… ๋ฐ ๊ด€๋ฆฌ ์ž‘์—… ์‹œ ๋ฃจํŠธ ์‚ฌ์šฉ์ž์˜ ์‚ฌ์šฉ์„ ๊ถŒ์žฅํ•˜์ง€ ์•Š๊ณ  ๊ณ„์ • ๋ฐ ๊ณผ๊ธˆ ๊ด€๋ฆฌ ์ž‘์—… ์ˆ˜ํ–‰์‹œ์—๋งŒ root ์‚ฌ์šฉ์ž ์‚ฌ์šฉ ๊ถŒ์žฅ

  • IAM (Identity and Access Management) ์‚ฌ์šฉ์ž

= AWS ์„œ๋น„์Šค์™€ ๋ฆฌ์†Œ์Šค์— ๋Œ€ํ•œ ์•ก์„ธ์Šค ํ†ต์ œ
= AWS ์‚ฌ์šฉ์ž ๋ฐ ๊ทธ๋ฃน์„ ๋งŒ๋“ค๊ณ  ๊ด€๋ฆฌํ•˜๋ฉฐ ๋ฆฌ์†Œ์Šค์— ๋Œ€ํ•œ ์•ก์„ธ์Šค ํ—ˆ์šฉ ๋ฐ ๊ฑฐ๋ถ€ ๊ฐ€๋Šฅ
= AWS ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•œ ๊ทธ๋ฃน, ์‚ฌ์šฉ์ž ๋ฐ ์—ญํ™œ(Role)์ƒ์„ฑ ๊ฐ€๋Šฅ

IAM ์ •์ฑ…

IAM ์ •์ฑ…์€ ํƒœ์Šคํฌ๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•๊ณผ ์ƒ๊ด€์—†์ด ์ž‘์—…์— ๋Œ€ํ•œ ๊ถŒํ•œ์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด,ย ์ •์ฑ… ์ด GetUser ์ž‘์—…์„ ํ—ˆ์šฉํ•œ๋‹ค๋ฉด ์ดย ์ •์ฑ… ์ด ์žˆ๋Š” ์‚ฌ์šฉ์ž๋Š” AWS Management Console, AWS CLI, ๋˜๋Š” AWS API์—์„œ ์‚ฌ์šฉ์ž ์ •๋ณด๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • Version = ์ •์ฑ… ์–ธ์–ด ๋ฒ„์ „
  • Statement = ์ •์ฑ… ์š”์†Œ๋ฅผ ๋‹ด๋Š” ์ปจํ…Œ์ด๋„ˆ

๊ถŒํ•œ๋ถ„์„(Statement)์„ ํ†ตํ•ด ์ž์›(Resource)์ด ํ—ˆ๊ฐ€/๊ฑฐ๋ถ€ ๋œ ์ž‘์—…(Action) ๊ถŒํ•œ ๋ถ€์—ฌ

  • Action = โ€œ OOO AWS ์„œ๋น„์Šคโ€๋ฅผ โ€œ์–ด๋–ค ์ž‘์—…โ€์„ ํ—ˆ๊ฐ€(๊ฑฐ๋ถ€)ํ• ์ง€ ์„ค์ •

ex) โ€œec2:Describe*โ€ = EC2์™€ ๊ด€๋ จ๋œ ๋ชจ๋“  ๊ถŒํ•œ์„ ๋‚˜ํƒ€๋ƒ„

  • Effect = ํ—ˆ๊ฐ€๋ฅผ ๋ถ€์—ฌํ•  ์ง€(Allow), ๊ฑฐ๋ถ€๋ฅผ ๋ถ€์—ฌํ• ์ง€(Deny) ์ •์ฑ… ๊ฒฐ์ •
  • Resource = โ€œOO AWS ๋ฆฌ์†Œ์Šคโ€์— ์ž‘์—…์„ ํ—ˆ๊ฐ€(๊ฑฐ๋ถ€)ํ• ์ง€ ์„ค์ •
{
"Version": "2012-10-17", 
"Statement": [
	{
		"Effect": "Allow", 
		"Action": "ec2:Describe*", 
		"Resource": "*"
	}, 
	{
		"Effect": "Allow",
		"Action": "elasticloadbalancing:Describe*", 
		"Resource": "*"
	}, 
	{
		"Effect": "Allow", 
		"Action": [
			"cloudwatch:ListMetrics", 
			"cloudwatch:GetMetricStatistics", 
			"cloudwatch:Describe*"
	],
		"Resource": "*" 
	},
	{
		"Effect": "Allow",
		"Action": "autoscaling:Describe*", 
		"Resource": "*"
	} 
]
}

IAM ์ธ์ฆ ์ •๋ณด(Credential)

= API Key, SSH Pubkey, AWS CLI & SDK ๋“ฑ ์„œ๋น„์Šค ํ‚ค๋ฅผ ํฌํ•จ
= ๊ฐœ๋ฐœ ์‹ค์ˆ˜, ํ™˜๊ฒฝ ์„ค์ • ๋ฏธํก ๋“ฑ์œผ๋กœ ๊ณต๊ฐœ๋œ ์ €์žฅ์†Œ์— ์ €์žฅ๋˜์ง€ ์•Š๋„๋ก ์œ ์˜ (์Šคํฌ๋ฆฐ์ƒท, ์ฝ”๋“œ ํ˜•์ƒ๊ด€๋ฆฌ ํŒŒ์ผ(.git, .env) ๊ด€๋ฆฌ ๋ฏธํก, ์„œ๋ฒ„์ธก ์ฝ”๋“œ, HTML ์ฝ”๋“œ ์ฃผ์„ ๋…ธ์ถœ ๋“ฑ ๋‹ค์–‘ํ•˜๊ฒŒ ์œ ์ถœ ๊ฐ€๋Šฅ)
= IAM ์‚ฌ์šฉ์ž๋Š” ๊ณ ์œ ํ•œ ์•ก์„ธ์Šค ํ‚ค๋ฅผ ์ž์‹ ์˜ ๊ถŒํ•œ์— ํ•œํ•˜์—ฌ ๊ต์ฒด ๊ฐ€๋Šฅ (๋‹จ, root ์‚ฌ์šฉ์ž๋Š” ๋ชจ๋“  IAM ์‚ฌ์šฉ์ž์˜ ํ‚ค ๊ด€๋ฆฌ์— ๊ด€์—ฌ ๊ฐ€๋Šฅ)
= ํ™˜๊ฒฝ๋ณ€์ˆ˜ ~/.aws/credentials ์— ์ €์žฅํ•˜์—ฌ ํ”„๋กœํŒŒ์ผ ๋“ฑ๋ก ํ›„ ์‚ฌ์šฉ

[default]
aws_access_key=id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXutnFEMI/K7MDENG/bPxRfiCYEXAPMP
  • ์ธ์ฆ์ •๋ณด ์œ ์ถœ ์‹œ ์œ„ํ˜‘

์ธ์Šคํ„ด์Šค ์กฐ์ž‘(์‹œ์ž‘,์ข…๋ฃŒ,์›๊ฒฉ์ ‘์†), ํƒ€ ์‚ฌ์šฉ์ž ์ƒ์„ฑ, ๊ถŒํ•œ๋ถ€์—ฌ, ๋กœ๊ทธ ์‚ญ์ œ ๋“ฑ์˜ ๊ณต๊ฒฉ์ด ๊ฐ€๋Šฅ



๐Ÿ Cheat sheet


๐Ÿ‘€ How to Prevent ?


๐Ÿ“ƒ References