Can't extract tar.gz wordpress on EC2 Ubuntu - amazon-web-services

I'm following this tutorial to install Wordpress on AWS Ec2 Ubuntu.
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-20-04-with-a-lamp-stack
When I run this part
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
I get this error:
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
I tried every kind of xzvf- combination and nothin seems to work.
Added here the download phase
Appreciate the help.

Related

How to install deb package in aws codebuild worker container

I'm trying to build docker container and push to to ECR repository. All is working fine locally, but once moved to AWS I'm getting error:
dpkg-deb: error: 'docker-ce_20.10.3_3-0_ubuntu-bionic_amd64.deb' is not a Debian format archive
dpkg: error processing archive docker-ce_20.10.3_3-0_ubuntu-bionic_amd64.deb (--install):
dpkg-deb --control subprocess returned error exit status 2
from following commands in Docker file:
COPY docker-assets/docker-ce_20.10.3_3-0_ubuntu-bionic_amd64.deb /home/folder/
RUN dpkg -i docker-ce_20.10.3_3-0_ubuntu-bionic_amd64.deb
Can anyone hit the same issue / help me out ?
I did workaround this with URL

Kafka Connect with Elasticsearch in AWS

I am trying to connect Kafka(MSK) in aws to Elasticsearch in aws. I set it up but currently getting an error.Here are the steps:
sudo apt-get update
sudo apt-install java-1.8.0
wget https://packages.confluent.io/archive/5.2/confluent-5.2.0-2.11.tar.gz?_ga=2.30447679.1453070970.1611201478-474568264.1611201478
tar -xf confluent-5.2.0-2.11.tar.gz
confluent-hub install confluentinc/kafka-connect-elasticsearch:11.0.0
export PATH=/home/ubuntu/confluent-5.2.0/bin:${PATH};
I then updated the connect-standalone.properties config file:
bootstrap.servers=b-1.xx.xx.c8.kafka.us-east-1.amazonaws.com:9092
key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
key.converter.schemas.enable=false
value.converter.schemas.enable=false
offset.storage.file.filename=/tmp/connect.offsets
plugin.path=share/java,/home/ubuntu/confluent-5.2.0/share/confluent-hub-components
Then I created another config file for the sink connector.
name=elasticsearch-sink
connector.class=io.confluent.connect.elasticsearch.ElasticsearchSinkConnector
tasks.max=1
topics=sampleTopic
topic.index.map=logs:logs_index
connection.url=https://xxxx.us-east-1.es.amazonaws.com:443
type.name=log
key.ignore=true
schema.ignore=true
Then I run the confluent standalone command to connect.
bin/connect-standalone etc/kafka/connect-standalone.properties etc/kafka/elasticsearch-connect.properties
It runs but then eventually throws an error which I can not figure out why. Bellow is the error:
ERROR Stopping after connector error (org.apache.kafka.connect.cli.ConnectStandalone:119)
java.lang.NoClassDefFoundError: org/apache/kafka/common/config/ConfigDef$CaseInsensitiveValidString
Any help or input would be great thank you.

Cant view downloaded file in cloudformation

Im trying to download a file using wget using Cloudformation. However, I dont see the file in the directory I downloaded it to ( /home/ubuntu/). Ive also tried different things like creating directories in /home/ubuntu but I also dont see the created directory
The following is the portition of the cloudformation code I am having trouble with. Lets assume that I am calling these commands correctly with cfn-init. I see the user data execute the cfn-init command but I dont see the files.
I wget the file and put it into /home/ubuntu/odbc_connector.tar.gz. When I go onto the server I do not find the file.
Instance:
Type: AWS::EC2::Instance
Metadata:
AWS::CloudFormation::Init:
configSets:
Instance_install:
# Install ODBC connector / pyodbc
- setup_pyodbc
setup_pyodbc:
commands:
# Install ODBC connector
download_connector:
command: wget https://dev.mysql.com/get/Downloads/Connector-ODBC/8.0/mysql-connector-odbc-8.0.19-linux-ubuntu18.04-x86-64bit.tar.gz -O /home/ubuntu/odbc_connector.tar.gz
Your wget command should be:
wget https://dev.mysql.com/get/Downloads/Connector-ODBC/8.0/mysql-connector-odbc-8.0.19-linux-ubuntu18.04-x86-64bit.tar.gz -O /home/ubuntu/odbc_connector.tar.gz
There may be other issues, that fail in your template, but you should still correct your wget command.
You can use the below command to debug the issue. You'll have to go into the instance =>
cat /var/log/cloud-init-output.log - to check cf error
cat /var/lib/cloud/instance/scripts/part-001 - to view script
The cloud-init-output.log should tell you why the command didn't run

Signature version 4 authentication failed while uploading bundle

I receive an error when running the following command on AWS CLI
Command
$EC2_AMITOOL_HOME/bin/ec2-upload-bundle -b my-s3-bucket/bundle_folder/bundle_name -m /tmp/image.manifest.xml -a AKIAJKHXU4GRYW7KPDBQ -s IGaclJWIIjT7ixyb2gXPfJ8Z00U469Urt5DzGhaJ
Error
Signature version 4 authentication failed, trying different signature
version ERROR: Error talking to S3: Server.NotImplemented(501): A
header you provided implies functionality that is not implemented
I have allowed the full permission to the user but still getting this error
I have ran this command before the above command
Command:
$EC2_AMITOOL_HOME/bin/ec2-bundle-vol -k /tmp/ce rt/Cpanel.pem -c /tmp/cert/certificate.pem -u 589680520298 -r x86_64 -e /tmp/cer t --partition gpt
It ran successfully and I have successfully generated image.manifest.xml
Manual Reference: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-instance-store-ami.html#amazon_linux_instructions
Please Provide Correct region of your bucket to authentication array this problem will be resolved.

chef zero via AWS userdata fails

When running chef zero via AWS userdata, the run always fails. However, if I ssh onto the machine and manually execute the same commands, it works as expected. This is the output that I get:
Chef: 11.12.8
[2014-06-11T12:40:34+00:00] INFO: Auto-discovered chef repository at /opt/chef-zero
[2014-06-11T12:40:34+00:00] INFO: Starting chef-zero on port 8889 with repository at repository at /opt/chef-zero
One version per cookbook
[2014-06-11T12:40:34+00:00] INFO: Forking chef instance to converge...
[2014-06-11T12:40:35+00:00] DEBUG: Fork successful. Waiting for new chef pid: 1530
[2014-06-11T12:40:35+00:00] DEBUG: Forked instance now converging
[2014-06-11T12:40:35+00:00] ERROR: undefined method `[]' for nil:NilClass
[2014-06-11T12:40:35+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
The userdata that I set when launching the EC2 instance in AWS includes the following:
curl -L https://www.opscode.com/chef/install.sh | bash
mkdir /opt/chef-zero
cd /opt/chef-zero
wget http://myserver/chef-repo.tar.gz
tar zxf chef-repo
INSTANCE_ID=`curl http://169.254.169.254/latest/meta-data/instance-id`
cat <<EOF > /opt/chef-zero/solo.rb
ssl_verify_mode :verify_peer
node_name "$INSTANCE_ID"
EOF
/opt/chef/bin/chef-client -v >chef-zero.log 2>&1
/opt/chef/bin/chef-client -z -l debug -c solo.rb -o 'role[someRole]' -E BUILD >> chef-zero.log 2>&1
The AMI that I'm using is a custom one that was initially provisioned using knife + knife-ec2 (that bootstrapped chef 11.6.0 from an ubuntu 13.04 public ami). The omnibus installer from userdata (curl ... | bash) is upgrading chef to 11.12.8. The original knife run included chef-client::service in it's run, and the host is initially configured for use with chef-client + chef-server (i.e. there's a "validation.pem" and "client.rb" in /etc/chef - not sure if that makes a difference).
I am able to log onto the machine and execute chef-client -z -c solo.rb -o 'role[someRole]' -E BUILD as soon as the machine comes up (after waiting for files to be retrieved and the user-data chef-client to fail) and the chef run executes normally.
I have no idea why the userdata chef-client run fails with undefined method, any ideas what's causing it?
After some further investigation, and thanks to bit of chatting with the #chef guys on freenode, the problem was narrowed down to the environment.
When executing the script with userdata, the "HOME" variable is not set. shell.rb from the chef gem is littered with references to ENV["HOME"].
SSH:
# unset HOME
# chef-client -z -o 'role[test]'
ERROR: undefined method `[]' for nil:NilClass
# export HOME=/root
# chef-client -z -o 'role[test]'
Starting Chef Client, version ....
...
Chef Client finished, ...
If you need to execute chef-client via user data, you should manually export HOME before trying to execute chef.
Bug has been reported at https://tickets.opscode.com/browse/CHEF-5365
edit
Submitted a pull request which has since been merged into master. https://github.com/opscode/chef/pull/1494
This likely has nothing to do with chef-zero but indicates a problem in your recipe code (whatever's inside that chef-repo.tar.gz, or is driven by role[someRole]). It indicates an attempt to access a sub-element of a hash like
node['foo']['bar']
but when node['foo'] is nil (undefined)
Check the stacktrace that's generated by the chef client run to narrow it down.