Score:1

Copying files to/from EC2 instance using SSM alone (no SSH or S3 bucket)

us flag
eof

I'm trying to setup a ready-to-run terraform template for some performance testing. It creates two EC2 instances in the same cluster placement group and preinstalls a bunch of tools. I don't know the SSH public keys of the users of it in advance and would prefer not to require users to copy and paste public keys into the terraform file before applying it.

For performance testing, I would need to copy files back and forth to the instance, i.e., source code to the instances and flamegraphs or logs back to the local machine. SSH is the standard solution, but as mentioned, it requires setting up SSH public keys. Another option would be to create a random S3 bucket and use the AWS CLI to copy files there and back, but it would require two steps to copy every file, i.e. to S3 and then to either the local machine or EC2 instance.

My question: Is there a way to copy files using the AWS CLI using e.g. SSM to an EC2 instance? Something that only requires having AWS credentials, i.e. what would already be required to execute terraform.

Score:0
cn flag

you can simply use the same pem keys that you had used at the time of ec2 instance creation with scp command to copy files back and forth to the instance.

eof avatar
us flag
eof
The point is that there's no PEM key, since you can create an EC2 instance without one if you're relying on SSM. However, I decided to drop this approach and just force the user of the template to provide an SSH public key.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.