How to get instance IDs attached to a load balancer with aws cli commands (aws elbv2 / elb) - amazon-s3

I am using aws cli command to get the instance IDs attached to a load balancer.
I have tried using aws cli command "aws elbv2" but this does not list EC2 instances like "aws elb" command
For classic load balancers you can use:
aws elb describe-load-balancers
And the output will include the Instance ID information
However, for application load balancers you have to use this command but the output does not include the instance IDs
aws elbv2 describe-load-balancers
How can i get the instance ID info with the aws elbv2 command? Or is there another command i can use to get the instances attached to the load balancer?

Related

Azure Devops - pipeline to delete single s3 file

I would like a pipeline setup that I can run manually. The idea here is that it deletes a single file held within an AWS S3 account. I know technically there are many ways to do this, but what is best practice?
Thank you!
You can use a task: AWS CLI and add it into pipeline to delete a single file held within an AWS S3 account.
You can follow below steps :
1、 You should create a service connection before adding a AWS CLI task to pipeline.
Create AWS service connection
2、 Add AWS CLI task to pipeline and configure required parameters. Please know the meaning of parameters about AWS CLI. You can refer the document :
Command structure in the AWS CLI
The command structure is like:
aws <command> <subcommand> [options and parameters]
In this example, you can use the command below to delete a single s3 file:
aws s3 rm s3://BUCKET_NAME/uploads/file_name.jpg
“s3://BUCKET_NAME/uploads/file_name.jpg” is the file path you saved in S3.
AWS CLI in pipeline
3 run the pipeline and the single s3 file can be deleted successfully.

GoReplay - Upload to S3 does not work

I am trying to capture all incoming traffic on a specific port using GoReplay and to upload it directly to S3 servers.
I am running a simple file server on port 8000 and a gor instance using the (simple) command
gor --input-raw :8000 --output-file s3://<MyBucket>/%Y_%m_%d_%H_%M_%S.log
I does create a temporal file at /tmp/ but other than that, id does not upload any thing to S3.
Additional information :
The OS is Ubuntu 14.04
AWS cli is installed.
The AWS credentials are deffined within the environent
It seems the information you are providing or scenario you explained is not complete however to upload a file from your EC2 machine to S3 is simple as written command below.
aws s3 cp yourSourceFile s3://your bucket
To see your file you can see your file by using below command
aws s3 ls s3://your bucket
However, s3 is object storage and you can't use it to upload those files which are continually editing or adding or updating.

Spinnaker Support for App ELB in AWS

Am facing 2 issues with Spinnaker new installation.
I could not see my Application load balancers listed in dropdown of load balancers tab while creating pipeline. We are currently using only app. load balancers in our current set up. I tried editing the JSON file of pipeline with below config and it didn't work. I verfied it by checking the ASG created in my AWS account and checked if there is any ELB/Target group associated but I couldn't see any.
"targetGroups": [
"TG-APP-ELB-NAME-DEV"
],
Hence, I would like to confirm how I can get support of App. ELB into Spinnaker installation and how to use it.
Also I have an ami search issue found.My current set up briefing is below.
One managing account - prod where my spinnaker ec2 is running & my prod application instances are running
Two managed accounts - dev & test where my application test instances are running.
When I create a new AMI in my dev AWS account and am trying to search the newly created AMI from my Spinnaker and it failed with error that it couldn't search the AMI first. Then I shared my AMI in dev to prod after which it was able to search it but failed with UnAuthorized error
Please help me clarify
1. If sharing is required for any new AMI from dev -> Prod or our spinnakerManaged role would take care of permissions
2. How to fix this problem and create AMI successfully.
Regarding #1, have you created the App Load Balancer through the Spinnaker UI or directly through AWS?
If it is the former, then make sure it follows the naming convention agreed by Spinnaker (I believe the balancer name should start with the app name)

Updating files for my static website on S3

I'm trying to update a static website I'm hosting on amazon AWS S3 - just need to put a new version of my resume up there. I've gone through the documentation and it seems as though I need to 'invalidate' the file - but all the guides I'm finding only talk about using cloudfront, which is a service I don't use.
So for a static website where I need to update a single file, how do I do that without cloudfront?
You can upload the file directly to S3 through the AWS S3 Console, programmatically using a package for python, ruby, etc., or using the AWS Command Line.
If you are using the AWS Command Line, you can upload a file to s3 using these commands:
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-1
Default output format [None]: json
$ aws s3 cp myvideo.mp4 s3://mybucket/

how to run instance in different through aws api tools

when i execute the command ec2-describe-availability-zones it shows
AVAILABILITYZONE us-east-1a available us-east-1
AVAILABILITYZONE us-east-1c available us-east-1
AVAILABILITYZONE us-east-1d available us-east-1
so.. i can only run instance in us-east-1
how can i use other region if i want to run instance in other refion like ue-west-1?
i had copy ami form us-east-1 to us-west-1
and i execute the command
ec2-run-instances ami-526a0662 -n 1 -k USweastOregon -g launch-wizard-2 --monitor
it shows
Client.InvalidAMIID.NotFound: The image id '[ami-526a0662]' does not exist
AMIs are region-specific. If you want to use an AMI in a different region, you must first copy it:
To use AMI Copy, simply select the AMI to be copied from within the
AWS Management Console, choose the destination region, and start the
copy. AMI Copy can also be accessed via the EC2 Command Line
Interface or EC2 API as described in the EC2 User’s Guide. Once the
copy is complete, the new AMI can be used to launch new EC2 instances
in the destination region.
The AMI in the new region will have a different AMI ID.
You should use the --region and specify eu-west-1 or us-west-1.
--region REGION
Specify REGION as the web service region to use.
This option will override the URL specified by the "-U URL" option
and EC2_URL environment variable.