Difference between revisions of "AWS"

From Wasya Wiki
Jump to: navigation, search
(Permissions)
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
* [[ aws ecs ]]
 
* [[ aws ecs ]]
 
* [[ aws rds ]]
 
* [[ aws rds ]]
 +
* [[ aws vpc ]]
 +
* [[ aws ec2 ]]
  
 
= Install =
 
= Install =
Line 17: Line 19:
 
</pre>
 
</pre>
  
= Permissions =
+
= Develop =
 +
== ssh into container ==
 +
<pre>
 +
aws ecs execute-command  \
 +
    --region us-east-2 \
 +
    --cluster fragile-cluster \
 +
    --task ae0ccaf26c1647d09ad5501b848b7cd3 \
 +
    --container example1 \
 +
    --command "/bin/bash" \
 +
    --interactive \
 +
    --profile ecs_driver_1
 +
 
 +
</pre>
 +
 
 +
== cloud ami images ==
 +
* https://cloud-images.ubuntu.com/locator/
 +
* https://public.ecr.aws/docker/library/httpd:2.4.57-bullseye
 +
<pre>
 +
 
 +
## ubuntu 22.04 us-east-1
 +
# ami-053053586808c3e70
 +
 
 +
## 22.04 us-east-2 amd64
 +
# ami-068cf3d51efeb20d6
 +
 
 +
## 22.04 us-east-2 amd64
 +
# ami-068cf3d51efeb20d6
 +
 
 +
</pre>
 +
 
 +
== Permissions ==
  
 
<pre>
 
<pre>
Line 30: Line 62:
 
     ]
 
     ]
 
   }
 
   }
 +
</pre>
 +
 +
=== s3 ===
 +
<pre>
 +
{
 +
"Version": "2012-10-17",
 +
"Statement": [
 +
{
 +
"Sid": "Statement1",
 +
"Effect": "Allow",
 +
"Action": [
 +
"s3:PutObject",
 +
"s3:GetObject",
 +
"s3:GetObjectVersion",
 +
"s3:GetObjectAcl",
 +
"s3:PutObjectAcl"
 +
],
 +
"Resource": [
 +
"arn:aws:s3:::ish-test-2024/*"
 +
]
 +
},
 +
{
 +
            "Sid": "Statement2",
 +
            "Effect": "Allow",
 +
            "Action": [
 +
                "s3:ListBucket"
 +
            ],
 +
            "Resource": [
 +
                "arn:aws:s3:::ish-test-2024"
 +
            ]
 +
        }
 +
]
 +
}
 
</pre>
 
</pre>
  
Line 36: Line 101:
  
 
   aws s3 sync s3://<from> s3://<to> --profile <profile>
 
   aws s3 sync s3://<from> s3://<to> --profile <profile>
 
= EC2 =
 
== keypairs ==
 
 
* From: https://docs.aws.amazon.com/cli/latest/userguide/cli-services-ec2-keypairs.html
 
 
<pre>
 
 
## us-east-1
 
## idrsa_ecs_key1
 
 
## us-east-2
 
## idrsa_ecs_key2
 
 
 
aws ec2 create-key-pair --key-name idrsa_ecs_key2 --query 'KeyMaterial' \
 
  --output text --profile rds_driver_1 > idrsa_ecs_key2.pem
 
 
aws ec2 describe-key-pairs --key-name idrsa_ecs_key2 --profile rds_driver_1
 
</pre>
 

Latest revision as of 18:58, 6 November 2024

Install

 curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
 unzip awscliv2.zip
 sudo ./aws/install
  ## ~/.aws/credentials
  [ish-ses]
  aws_access_key_id = <>
  aws_secret_access_key = <>

Develop

ssh into container

aws ecs execute-command  \
    --region us-east-2 \
    --cluster fragile-cluster \
    --task ae0ccaf26c1647d09ad5501b848b7cd3 \
    --container example1 \
    --command "/bin/bash" \
    --interactive \
    --profile ecs_driver_1

cloud ami images


## ubuntu 22.04 us-east-1
# ami-053053586808c3e70

## 22.04 us-east-2 amd64
# 	ami-068cf3d51efeb20d6

## 22.04 us-east-2 amd64
# 	ami-068cf3d51efeb20d6

Permissions

  {
    "Version": "2012-10-17",
    "Statement": [
      {
        "Effect": "Allow",
        "Action": "ses:SendRawEmail",
        "Resource": "*"
      }
    ]
  }

s3

{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Sid": "Statement1",
			"Effect": "Allow",
			"Action": [
				"s3:PutObject",
				"s3:GetObject",
				"s3:GetObjectVersion",
				"s3:GetObjectAcl",
				"s3:PutObjectAcl"
			],
			"Resource": [
				"arn:aws:s3:::ish-test-2024/*"
			]
		},
		{
            "Sid": "Statement2",
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::ish-test-2024"
            ]
        }
	]
}

s3

duplicate a bucket

  aws s3 sync s3://<from> s3://<to> --profile <profile>