Copy Automation pending:
https://github.com/rajasgs/aws-cli-grep
aws --version
aws-cli/2.9.0 Python/3.9.11 Darwin/18.7.0 exe/x86_64 prompt/off
which aws
/usr/local/bin/aws
Run AWS Image pipeline:
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/imagebuilder/start-image-pipeline-execution.html
aws imagebuilder start-image-pipeline-execution \
--image-pipeline-arn arn:aws:imagebuilder:ca-central-1:723675304964:image-pipeline/rajalinuximagepipeline
{
"requestId": "a24daa7b-bb1c-4b25-92a7-26505eb86c00",
"clientToken": "96dcbea7-9ffb-446b-b092-a4007f299514",
"imageBuildVersionArn": "arn:aws:imagebuilder:ca-central-1:723675304964:image/rj-linux-image-recipe/1.0.0/4"
}
List AWS EC2 Image pipelines
aws imagebuilder list-image-pipelines
{
"requestId": "4204bee5-95ba-4f64-ab49-f399363b8c94",
"imagePipelineList": [
{
"arn": "arn:aws:imagebuilder:ca-central-1:723675304964:image-pipeline/rajalinuximagepipeline",
"name": "RajaLinuxImagePipeline",
"description": "Raja Linux Image Pipeline",
"platform": "Linux",
"enhancedImageMetadataEnabled": true,
"imageRecipeArn": "arn:aws:imagebuilder:ca-central-1:723675304964:image-recipe/rj-linux-image-recipe/1.0.0",
"infrastructureConfigurationArn": "arn:aws:imagebuilder:ca-central-1:723675304964:infrastructure-configuration/rj-linux-image-builder-8fb08f31-e6cf-4bfd-bef5-57a93236ebee",
"distributionConfigurationArn": "arn:aws:imagebuilder:ca-central-1:723675304964:distribution-configuration/rj-linux-image-builder-8fb08f31-e6cf-4bfd-bef5-57a93236ebee",
"imageTestsConfiguration": {
"imageTestsEnabled": true,
"timeoutMinutes": 720
},
"status": "ENABLED",
"dateCreated": "2022-11-22T02:11:04.820Z",
"dateUpdated": "2022-11-22T02:11:04.820Z",
"tags": {}
}
]
}
List image recipe:
aws imagebuilder list-image-recipes
{
"requestId": "1e4d9be1-0267-4305-8a31-d1e30cad1f0f",
"imageRecipeSummaryList": [
{
"arn": "arn:aws:imagebuilder:ca-central-1:723675304964:image-recipe/rj-linux-image-recipe/1.0.0",
"name": "RJ-Linux-Image-Recipe",
"platform": "Linux",
"owner": "723675304964",
"parentImage": "arn:aws:imagebuilder:ca-central-1:aws:image/ubuntu-server-20-lts-x86/x.x.x",
"dateCreated": "2022-11-21T17:59:02.810Z",
"tags": {}
}
]
}
list images:
aws imagebuilder list-images
{
"requestId": "a4e22ed2-9659-451e-8580-6e78407647c6",
"imageVersionList": [
{
"arn": "arn:aws:imagebuilder:ca-central-1:723675304964:image/rj-linux-image-recipe/1.0.0",
"name": "RJ-Linux-Image-Recipe",
"type": "AMI",
"version": "1.0.0",
"platform": "Linux",
"osVersion": "Ubuntu 20",
"owner": "723675304964",
"dateCreated": "2022-11-22T10:55:17.929Z",
"buildType": "USER_INITIATED"
},
{
"arn": "arn:aws:imagebuilder:ca-central-1:723675304964:image/rj-scraper-image-recipe/1.0.0",
"name": "rj-scraper-image-recipe",
"type": "AMI",
"version": "1.0.0",
"platform": "Linux",
"osVersion": "Amazon Linux 2",
"owner": "723675304964",
"dateCreated": "2022-11-21T10:37:08.369Z",
"buildType": "USER_INITIATED"
}
]
}
list keypairs
aws ec2 describe-key-pairs
{
"KeyPairs": [
{
"KeyPairId": "key-0838e6463d83e96f3",
"KeyFingerprint": "41:fb:9f:a2:02:4a:08:a8:1a:1d:38:47:20:7b:00:9e:5e:db:c2:39",
"KeyName": "rj-tester-key",
"KeyType": "rsa",
"Tags": [],
"CreateTime": "2022-08-25T01:20:24+00:00"
}
]
}
list security group ids
aws ec2 describe-security-groups
{
"SecurityGroups": [
{
"Description": "launch-wizard-1 created 2022-11-21T17:21:38.416Z",
"GroupName": "launch-wizard-1",
"IpPermissions": [
{
"FromPort": 22,
"IpProtocol": "tcp",
"IpRanges": [
{
"CidrIp": "52.3.141.123/32"
}
],
"Ipv6Ranges": [],
"PrefixListIds": [],
"ToPort": 22,
"UserIdGroupPairs": []
}
],
"OwnerId": "723675304964",
"GroupId": "sg-0049271e54bfd052e",
"IpPermissionsEgress": [
{
"IpProtocol": "-1",
"IpRanges": [
{
"CidrIp": "0.0.0.0/0"
}
],
"Ipv6Ranges": [],
"PrefixListIds": [],
"UserIdGroupPairs": []
}
],
"VpcId": "vpc-4ec5c326"
},
{
"Description": "RJ Tester SG",
"GroupName": "rj-tester-sg",
"IpPermissions": [
{
"FromPort": 22,
"IpProtocol": "tcp",
"IpRanges": [
{
"CidrIp": "52.3.141.123/32"
}
],
"Ipv6Ranges": [],
"PrefixListIds": [],
"ToPort": 22,
"UserIdGroupPairs": []
}
],
"OwnerId": "723675304964",
"GroupId": "sg-0ed5b9b7488b55819",
"IpPermissionsEgress": [
{
"IpProtocol": "-1",
"IpRanges": [
{
"CidrIp": "0.0.0.0/0"
}
],
"Ipv6Ranges": [],
"PrefixListIds": [],
"UserIdGroupPairs": []
}
],
"VpcId": "vpc-4ec5c326"
}
]
}
aws ec2 run-instances --image-id ami-04d38256e475591da --count 1 \
--instance-type t2.micro --key-name rj-tester-key \
--security-group-ids sg-0ed5b9b7488b55819
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/index.html
{
"Groups": [],
"Instances": [
{
"AmiLaunchIndex": 0,
"ImageId": "ami-04d38256e475591da",
"InstanceId": "i-00a0fe6eaf35227d6",
"InstanceType": "t2.micro",
"KeyName": "rj-tester-key",
"LaunchTime": "2022-11-22T12:01:03+00:00",
"Monitoring": {
"State": "disabled"
},
"Placement": {
"AvailabilityZone": "ca-central-1a",
"GroupName": "",
"Tenancy": "default"
},
"PrivateDnsName": "ip-172-31-20-125.ca-central-1.compute.internal",
"PrivateIpAddress": "172.31.20.125",
"ProductCodes": [],
"PublicDnsName": "",
"State": {
"Code": 0,
"Name": "pending"
},
"StateTransitionReason": "",
"SubnetId": "subnet-27ccf84f",
"VpcId": "vpc-4ec5c326",
"Architecture": "x86_64",
"BlockDeviceMappings": [],
"ClientToken": "5c82ad2a-4dbd-4002-9f41-3bde1962dbe2",
"EbsOptimized": false,
"EnaSupport": true,
"Hypervisor": "xen",
"NetworkInterfaces": [
{
"Attachment": {
"AttachTime": "2022-11-22T12:01:03+00:00",
"AttachmentId": "eni-attach-0c73ba1a2bf25278d",
"DeleteOnTermination": true,
"DeviceIndex": 0,
"Status": "attaching",
"NetworkCardIndex": 0
},
"Description": "",
"Groups": [
{
"GroupName": "rj-tester-sg",
"GroupId": "sg-0ed5b9b7488b55819"
}
],
"Ipv6Addresses": [],
"MacAddress": "02:5b:25:ce:a2:54",
"NetworkInterfaceId": "eni-078b2e3a21136e959",
"OwnerId": "723675304964",
"PrivateDnsName": "ip-172-31-20-125.ca-central-1.compute.internal",
"PrivateIpAddress": "172.31.20.125",
"PrivateIpAddresses": [
{
"Primary": true,
"PrivateDnsName": "ip-172-31-20-125.ca-central-1.compute.internal",
"PrivateIpAddress": "172.31.20.125"
}
],
"SourceDestCheck": true,
"Status": "in-use",
"SubnetId": "subnet-27ccf84f",
"VpcId": "vpc-4ec5c326",
"InterfaceType": "interface"
}
],
"RootDeviceName": "/dev/sda1",
"RootDeviceType": "ebs",
"SecurityGroups": [
{
"GroupName": "rj-tester-sg",
"GroupId": "sg-0ed5b9b7488b55819"
}
],
"SourceDestCheck": true,
"StateReason": {
"Code": "pending",
"Message": "pending"
},
"VirtualizationType": "hvm",
"CpuOptions": {
"CoreCount": 1,
"ThreadsPerCore": 1
},
"CapacityReservationSpecification": {
"CapacityReservationPreference": "open"
},
"MetadataOptions": {
"State": "pending",
"HttpTokens": "optional",
"HttpPutResponseHopLimit": 1,
"HttpEndpoint": "enabled",
"HttpProtocolIpv6": "disabled",
"InstanceMetadataTags": "disabled"
},
"EnclaveOptions": {
"Enabled": false
},
"PrivateDnsNameOptions": {
"HostnameType": "ip-name",
"EnableResourceNameDnsARecord": false,
"EnableResourceNameDnsAAAARecord": false
},
"MaintenanceOptions": {
"AutoRecovery": "default"
}
}
],
"OwnerId": "723675304964",
"ReservationId": "r-090762edd42cef59e"
}
aws ec2 run-instances --image-id ami-04d38256e475591da --count 1 \
--instance-type t2.micro --key-name rj-tester-key \
--security-group-ids sg-0ed5b9b7488b55819
--user-data file://my_script.txt
ssh -i "~/.ssh/rj-tester-key.pem" ubuntu@ec2-99-79-62-107.ca-central-1.compute.amazonaws.com
docker -v
Docker version 20.10.21, build baeda1f